[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Source view] [Print] [Project Stats]
File contains all the administration image manipulation functions.
File Size: | 1293 lines (43 kb) |
Included or required: | 7 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
wp_crop_image( $src, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs = false, $dst_file = false ) X-Ref |
Crops an image to a given size. return: string|WP_Error New filepath on success, WP_Error on failure. 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: bool|false $src_abs Optional. If the source crop points are absolute. param: string|false $dst_file Optional. The destination file to write to. |
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. return: array[] Associative array of arrays of image sub-size information for param: int $attachment_id The image attachment post ID. |
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. return: array|WP_Error The updated image meta data array or WP_Error object param: int $attachment_id The image attachment post ID. |
_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. return: array The updated image meta data. 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. |
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. return: array The image attachment meta data. param: string $file Full path to the image file. param: int $attachment_id Attachment ID to process. |
_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. return: array The attachment meta data with updated `sizes` array. Includes an array of errors encountered while resizing. 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. |
wp_copy_parent_attachment_properties( $cropped, $parent_attachment_id, $context = '' ) X-Ref |
Copy parent attachment properties to newly cropped image. return: array Properties of attachment. param: string $cropped Path to the cropped image file. param: int $parent_attachment_id Parent file Attachment ID. param: string $context Control calling the function. |
wp_generate_attachment_metadata( $attachment_id, $file ) X-Ref |
Generates attachment meta data and create image sub-sizes for images. return: array Metadata for attachment. param: int $attachment_id Attachment ID to process. param: string $file Filepath of the attached image. |
wp_exif_frac2dec( $str ) X-Ref |
Converts a fraction string to a decimal. return: int|float Returns calculated fraction or integer 0 on invalid input. param: string $str Fraction string. |
wp_exif_date2ts( $str ) X-Ref |
Converts the exif date format to a unix timestamp. return: int|false The unix timestamp, or false on failure. param: string $str A date string expected to be in Exif format (Y:m:d H:i:s). |
wp_read_image_metadata( $file ) X-Ref |
Gets 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. return: array|false Image metadata array on success, false on failure. param: string $file |
file_is_valid_image( $path ) X-Ref |
Validates that file is an image. return: bool True if valid image, false if not valid image. param: string $path File path to test if valid image. |
file_is_displayable_image( $path ) X-Ref |
Validates that file is suitable for displaying within a web page. return: bool True if suitable, false if not suitable. param: string $path File path to test. |
load_image_to_edit( $attachment_id, $mime_type, $size = 'full' ) X-Ref |
Loads an image resource for editing. return: resource|GdImage|false The resulting image resource or GdImage instance on success, param: int $attachment_id Attachment ID. param: string $mime_type Image mime type. param: string|int[] $size Optional. Image size. Accepts any registered image size name, or an array |
_load_image_to_edit_path( $attachment_id, $size = 'full' ) X-Ref |
Retrieves 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 `allow_url_fopen` is supported. return: string|false File path or URL on success, false on failure. param: int $attachment_id Attachment ID. param: string|int[] $size Optional. Image size. Accepts any registered image size name, or an array |
_copy_image_file( $attachment_id ) X-Ref |
Copies an existing image file. return: string|false New file path on success, false on failure. param: int $attachment_id Attachment ID. |
Generated : Sat Nov 23 08:20:01 2024 | Cross-referenced by PHPXref |