[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

title

Body

[close]

/wp-admin/includes/ -> image.php (summary)

File contains all the administration image manipulation functions.

File Size: 1045 lines (34 kb)
Included or required: 5 times
Referenced: 0 times
Includes or requires: 0 files

Defines 15 functions

  wp_crop_image()
  wp_get_missing_image_subsizes()
  wp_update_image_subsizes()
  _wp_image_meta_replace_original()
  wp_create_image_subsizes()
  _wp_make_subsizes()
  wp_generate_attachment_metadata()
  wp_exif_frac2dec()
  wp_exif_date2ts()
  wp_read_image_metadata()
  file_is_valid_image()
  file_is_displayable_image()
  load_image_to_edit()
  _load_image_to_edit_path()
  _copy_image_file()

Functions
Functions that are not part of a class:

wp_crop_image( $src, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs = false, $dst_file = false )   X-Ref
Crop an Image to a given size.

param: string|int $src The source file or Attachment ID.
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 The destination width.
param: int $dst_h The destination height.
param: int $src_abs Optional. If the source crop points are absolute.
param: string $dst_file Optional. The destination file to write to.
return: string|WP_Error New filepath on success, WP_Error on failure.

wp_get_missing_image_subsizes( $attachment_id )   X-Ref
Compare the existing image sub-sizes (as saved in the attachment meta)
to the currently registered image sub-sizes, and return the difference.

Registered sub-sizes that are larger than the image are skipped.

param: int $attachment_id The image attachment post ID.
return: array An array of the image sub-sizes that are currently defined but don't exist for this image.

wp_update_image_subsizes( $attachment_id )   X-Ref
If any of the currently registered image sub-sizes are missing,
create them and update the image meta data.

param: int $attachment_id The image attachment post ID.
return: array|WP_Error The updated image meta data array or WP_Error object

_wp_image_meta_replace_original( $saved_data, $original_file, $image_meta, $attachment_id )   X-Ref
Updates the attached file and image meta data when the original image was edited.

param: array  $saved_data    The data returned from WP_Image_Editor after successfully saving an image.
param: string $original_file Path to the original file.
param: array  $image_meta    The image meta data.
param: int    $attachment_id The attachment post ID.
return: array The updated image meta data.

wp_create_image_subsizes( $file, $attachment_id )   X-Ref
Creates image sub-sizes, adds the new data to the image meta `sizes` array, and updates the image metadata.

Intended for use after an image is uploaded. Saves/updates the image metadata after each
sub-size is created. If there was an error, it is added to the returned image metadata array.

param: string $file          Full path to the image file.
param: int    $attachment_id Attachment Id to process.
return: array The image attachment meta data.

_wp_make_subsizes( $new_sizes, $file, $image_meta, $attachment_id )   X-Ref
Low-level function to create image sub-sizes.

Updates the image meta after each sub-size is created.
Errors are stored in the returned image metadata array.

param: array  $new_sizes     Array defining what sizes to create.
param: string $file          Full path to the image file.
param: array  $image_meta    The attachment meta data array.
param: int    $attachment_id Attachment Id to process.
return: array The attachment meta data with updated `sizes` array. Includes an array of errors encountered while resizing.

wp_generate_attachment_metadata( $attachment_id, $file )   X-Ref
Generate attachment meta data and create image sub-sizes for images.

param: int $attachment_id Attachment Id to process.
param: string $file Filepath of the Attached image.
return: mixed Metadata for attachment.

wp_exif_frac2dec( $str )   X-Ref
Convert a fraction string to a decimal.

param: string $str
return: int|float

wp_exif_date2ts( $str )   X-Ref
Convert the exif date format to a unix timestamp.

param: string $str
return: int

wp_read_image_metadata( $file )   X-Ref
Get extended image metadata, exif or iptc as available.

Retrieves the EXIF metadata aperture, credit, camera, caption, copyright, iso
created_timestamp, focal_length, shutter_speed, and title.

The IPTC metadata that is retrieved is APP13, credit, byline, created date
and time, caption, copyright, and title. Also includes FNumber, Model,
DateTimeDigitized, FocalLength, ISOSpeedRatings, and ExposureTime.

param: string $file
return: bool|array False on failure. Image metadata array on success.

file_is_valid_image( $path )   X-Ref
Validate that file is an image.

param: string $path File path to test if valid image.
return: bool True if valid image, false if not valid image.

file_is_displayable_image( $path )   X-Ref
Validate that file is suitable for displaying within a web page.

param: string $path File path to test.
return: bool True if suitable, false if not suitable.

load_image_to_edit( $attachment_id, $mime_type, $size = 'full' )   X-Ref
Load an image resource for editing.

param: string $attachment_id Attachment ID.
param: string $mime_type Image mime type.
param: string $size Optional. Image size, defaults to 'full'.
return: resource|false The resulting image resource on success, false on failure.

_load_image_to_edit_path( $attachment_id, $size = 'full' )   X-Ref
Retrieve the path or url of an attachment's attached file.

If the attached file is not present on the local filesystem (usually due to replication plugins),
then the url of the file is returned if url fopen is supported.

param: string $attachment_id Attachment ID.
param: string $size Optional. Image size, defaults to 'full'.
return: string|false File path or url on success, false on failure.

_copy_image_file( $attachment_id )   X-Ref
Copy an existing image file.

param: string $attachment_id Attachment ID.
return: string|false New file path on success, false on failure.



Generated: Sat Nov 23 20:47:33 2019 Cross-referenced by PHPXref 0.7