[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/ -> class-wp-image-editor-gd.php (summary)

WordPress GD Image Editor

File Size: 551 lines (16 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

WP_Image_Editor_GD:: (16 methods):
  __destruct()
  test()
  supports_mime_type()
  load()
  update_size()
  resize()
  _resize()
  multi_resize()
  make_subsize()
  crop()
  rotate()
  flip()
  save()
  _save()
  stream()
  make_image()


Class: WP_Image_Editor_GD  - X-Ref

WordPress Image Editor Class for Image Manipulation through GD

__destruct()   X-Ref
GD Resource.


test( $args = array()   X-Ref
Checks to see if current environment supports GD.

return: bool
param: array $args
since: 3.5.0

supports_mime_type( $mime_type )   X-Ref
Checks to see if editor supports the mime-type specified.

return: bool
param: string $mime_type
since: 3.5.0

load()   X-Ref
Loads image from $this->file into new GD Resource.

return: true|WP_Error True if loaded successfully; WP_Error on failure.
since: 3.5.0

update_size( $width = false, $height = false )   X-Ref
No description

resize( $max_w, $max_h, $crop = false )   X-Ref
Resizes current image.

Wraps `::_resize()` which returns a GD resource or GdImage instance.

At minimum, either a height or width must be provided. If one of the two is set
to null, the resize will maintain aspect ratio according to the provided dimension.

return: true|WP_Error
param: int|null $max_w Image width.
param: int|null $max_h Image height.
param: bool     $crop
since: 3.5.0

_resize( $max_w, $max_h, $crop = false )   X-Ref

return: resource|GdImage|WP_Error
param: int        $max_w
param: int        $max_h
param: bool|array $crop

multi_resize( $sizes )   X-Ref
Create multiple smaller images from a single source.

Attempts to create all sub-sizes and returns the meta data at the end. This
may result in the server running out of resources. When it fails there may be few
"orphaned" images left over as the meta data is never returned and saved.

As of 5.3.0 the preferred way to do this is with `make_subsize()`. It creates
the new images one at a time and allows for the meta data to be saved after
each new image is created.

return: array An array of resized images' metadata by size.
param: array $sizes {
since: 3.5.0

make_subsize( $size_data )   X-Ref
Create an image sub-size and return the image meta data value for it.

return: array|WP_Error The image data array for inclusion in the `sizes` array in the image meta,
param: array $size_data {
since: 5.3.0

crop( $src_x, $src_y, $src_w, $src_h, $dst_w = null, $dst_h = null, $src_abs = false )   X-Ref
Crops Image.

return: true|WP_Error
param: int  $src_x   The start x position to crop from.
param: int  $src_y   The start y position to crop from.
param: int  $src_w   The width to crop.
param: int  $src_h   The height to crop.
param: int  $dst_w   Optional. The destination width.
param: int  $dst_h   Optional. The destination height.
param: bool $src_abs Optional. If the source crop points are absolute.
since: 3.5.0

rotate( $angle )   X-Ref
Rotates current image counter-clockwise by $angle.
Ported from image-edit.php

return: true|WP_Error
param: float $angle
since: 3.5.0

flip( $horz, $vert )   X-Ref
Flips current image.

return: true|WP_Error
param: bool $horz Flip along Horizontal Axis.
param: bool $vert Flip along Vertical Axis.
since: 3.5.0

save( $destfilename = null, $mime_type = null )   X-Ref
Saves current in-memory image to file.

return: array|WP_Error {'path'=>string, 'file'=>string, 'width'=>int, 'height'=>int, 'mime-type'=>string}
param: string|null $destfilename Optional. Destination filename. Default null.
param: string|null $mime_type    Optional. The mime-type. Default null.
since: 3.5.0
since: 5.9.0 Renamed `$filename` to `$destfilename` to match parent class

_save( $image, $filename = null, $mime_type = null )   X-Ref

return: array|WP_Error
param: resource|GdImage $image
param: string|null      $filename
param: string|null      $mime_type

stream( $mime_type = null )   X-Ref
Returns stream of current image.

return: bool True on success, false on failure.
param: string $mime_type The mime type of the image.
since: 3.5.0

make_image( $filename, $callback, $arguments )   X-Ref
Either calls editor's save function or handles file as a stream.

return: bool
param: string   $filename
param: callable $callback
param: array    $arguments
since: 3.5.0



Generated: Thu Nov 21 01:00:03 2024 Cross-referenced by PHPXref 0.7.1