[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

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

Base WordPress Image Editor

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

Defines 15 functions

  __construct()
  test()
  supports_mime_type()
  get_size()
  update_size()
  get_quality()
  set_quality()
  get_default_quality()
  get_output_format()
  generate_filename()
  get_suffix()
  maybe_exif_rotate()
  make_image()
  get_mime_type()
  get_extension()

Functions
Functions that are not part of a class:

__construct( $file )   X-Ref
Each instance handles a single file.

param: string $file Path to the file to load.

test( $args = array()   X-Ref
Checks to see if current environment supports the editor chosen.
Must be overridden in a subclass.

param: array $args
return: bool

supports_mime_type( $mime_type )   X-Ref
Checks to see if editor supports the mime-type specified.
Must be overridden in a subclass.

param: string $mime_type
return: bool

get_size()   X-Ref
Gets dimensions of image.

return: int[] {

update_size( $width = null, $height = null )   X-Ref
Sets current image size.

param: int $width
param: int $height
return: true

get_quality()   X-Ref
Gets the Image Compression quality on a 1-100% scale.

return: int Compression Quality. Range: [1,100]

set_quality( $quality = null )   X-Ref
Sets Image Compression quality on a 1-100% scale.

param: int $quality Compression Quality. Range: [1,100]
return: true|WP_Error True if set successfully; WP_Error on failure.

get_default_quality( $mime_type )   X-Ref
Returns the default compression quality setting for the mime type.

param: string $mime_type
return: int The default quality setting for the mime type.

get_output_format( $filename = null, $mime_type = null )   X-Ref
Returns preferred mime-type and extension based on provided
file's extension and mime, or current file's extension and mime.

Will default to $this->default_mime_type if requested is not supported.

Provides corrected filename only if filename is provided.

param: string $filename
param: string $mime_type
return: array { filename|null, extension, mime-type }

generate_filename( $suffix = null, $dest_path = null, $extension = null )   X-Ref
Builds an output filename based on current file, and adding proper suffix

param: string $suffix
param: string $dest_path
param: string $extension
return: string filename

get_suffix()   X-Ref
Builds and returns proper suffix for file based on height and width.

return: string|false suffix

maybe_exif_rotate()   X-Ref
Check if a JPEG image has EXIF Orientation tag and rotate it if needed.

return: bool|WP_Error True if the image was rotated. False if not rotated (no EXIF data or the image doesn't need to be rotated).

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

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

get_mime_type( $extension = null )   X-Ref
Returns first matched mime-type from extension,
as mapped from wp_get_mime_types()

param: string $extension
return: string|false

get_extension( $mime_type = null )   X-Ref
Returns first matched extension from Mime-type,
as mapped from wp_get_mime_types()

param: string $mime_type
return: string|false



Generated : Thu Mar 28 08:20:01 2024 Cross-referenced by PHPXref