[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/ -> media.php (summary)

WordPress API for media display.

File Size: 5400 lines (186 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 4 files
 wp-includes/class-wp-image-editor-gd.php
 wp-includes/class-wp-image-editor-imagick.php
 wp-includes/media-template.php
 wp-includes/class-wp-image-editor.php

Defines 79 functions

  wp_get_additional_image_sizes()
  image_constrain_size_for_editor()
  image_hwstring()
  image_downsize()
  add_image_size()
  has_image_size()
  remove_image_size()
  set_post_thumbnail_size()
  get_image_tag()
  wp_constrain_dimensions()
  image_resize_dimensions()
  image_make_intermediate_size()
  wp_image_matches_ratio()
  image_get_intermediate_size()
  get_intermediate_image_sizes()
  wp_get_registered_image_subsizes()
  wp_get_attachment_image_src()
  wp_get_attachment_image()
  wp_get_attachment_image_url()
  _wp_get_attachment_relative_path()
  _wp_get_image_size_from_meta()
  wp_get_attachment_image_srcset()
  wp_calculate_image_srcset()
  wp_get_attachment_image_sizes()
  wp_calculate_image_sizes()
  wp_image_file_matches_image_meta()
  wp_image_src_get_dimensions()
  wp_image_add_srcset_and_sizes()
  wp_lazy_loading_enabled()
  wp_filter_content_tags()
  wp_img_tag_add_loading_attr()
  wp_img_tag_add_width_and_height_attr()
  wp_img_tag_add_srcset_and_sizes_attr()
  wp_iframe_tag_add_loading_attr()
  _wp_post_thumbnail_class_filter()
  _wp_post_thumbnail_class_filter_add()
  _wp_post_thumbnail_class_filter_remove()
  img_caption_shortcode()
  gallery_shortcode()
  wp_underscore_playlist_templates()
  wp_playlist_scripts()
  wp_get_video_extensions()
  wp_video_shortcode()
  get_previous_image_link()
  previous_image_link()
  get_next_image_link()
  next_image_link()
  get_adjacent_image_link()
  adjacent_image_link()
  get_attachment_taxonomies()
  get_taxonomies_for_attachments()
  is_gd_image()
  wp_imagecreatetruecolor()
  wp_expand_dimensions()
  wp_max_upload_size()
  wp_get_image_editor()
  wp_image_editor_supports()
  _wp_image_editor_choose()
  wp_plupload_default_settings()
  wp_prepare_attachment_for_js()
  wp_enqueue_media()
  get_attached_media()
  get_media_embedded_in_content()
  get_post_galleries()
  get_post_gallery()
  get_post_galleries_images()
  get_post_gallery_images()
  wp_maybe_generate_attachment_metadata()
  attachment_url_to_postid()
  wpview_media_sandbox_styles()
  wp_register_media_personal_data_exporter()
  wp_media_personal_data_exporter()
  _wp_add_additional_image_sizes()
  wp_show_heic_upload_error()
  wp_getimagesize()
  wp_get_webp_info()
  wp_get_loading_attr_default()
  wp_omit_loading_attr_threshold()
  wp_increase_content_media_count()

Functions
Functions that are not part of a class:

wp_get_additional_image_sizes()   X-Ref
Retrieve additional image sizes.

return: array Additional images size data.
since: 4.7.0

image_constrain_size_for_editor( $width, $height, $size = 'medium', $context = null )   X-Ref
Scale down the default size of an image.

This is so that the image is a better fit for the editor and theme.

The `$size` parameter accepts either an array or a string. The supported string
values are 'thumb' or 'thumbnail' for the given thumbnail size or defaults at
128 width and 96 height in pixels. Also supported for the string value is
'medium', 'medium_large' and 'full'. The 'full' isn't actually supported, but any value other
than the supported will result in the content_width size or 500 if that is
not set.

Finally, there is a filter named {@see 'editor_max_image_size'}, that will be
called on the calculated array for width and height, respectively.

return: int[] {
param: int          $width   Width of the image in pixels.
param: int          $height  Height of the image in pixels.
param: string|int[] $size    Optional. Image size. Accepts any registered image size name, or an array
param: string       $context Optional. Could be 'display' (like in a theme) or 'edit'
since: 2.5.0

image_hwstring( $width, $height )   X-Ref
Retrieve width and height attributes using given width and height values.

Both attributes are required in the sense that both parameters must have a
value, but are optional in that if you set them to false or null, then they
will not be added to the returned string.

You can set the value using a string, but it will only take numeric values.
If you wish to put 'px' after the numbers, then it will be stripped out of
the return.

return: string HTML attributes for width and, or height.
param: int|string $width  Image width in pixels.
param: int|string $height Image height in pixels.
since: 2.5.0

image_downsize( $id, $size = 'medium' )   X-Ref
Scale an image to fit a particular size (such as 'thumb' or 'medium').

The URL might be the original image, or it might be a resized version. This
function won't create a new resized copy, it will just return an already
resized one if it exists.

A plugin may use the {@see 'image_downsize'} filter to hook into and offer image
resizing services for images. The hook must return an array with the same
elements that are normally returned from the function.

return: array|false {
param: int          $id   Attachment ID for image.
param: string|int[] $size Optional. Image size. Accepts any registered image size name, or an array
since: 2.5.0

add_image_size( $name, $width = 0, $height = 0, $crop = false )   X-Ref
Register a new image size.

param: string     $name   Image size identifier.
param: int        $width  Optional. Image width in pixels. Default 0.
param: int        $height Optional. Image height in pixels. Default 0.
param: bool|array $crop   Optional. Image cropping behavior. If false, the image will be scaled (default),
since: 2.9.0

has_image_size( $name )   X-Ref
Check if an image size exists.

return: bool True if the image size exists, false if not.
param: string $name The image size to check.
since: 3.9.0

remove_image_size( $name )   X-Ref
Remove a new image size.

return: bool True if the image size was successfully removed, false on failure.
param: string $name The image size to remove.
since: 3.9.0

set_post_thumbnail_size( $width = 0, $height = 0, $crop = false )   X-Ref
Registers an image size for the post thumbnail.

param: int        $width  Image width in pixels.
param: int        $height Image height in pixels.
param: bool|array $crop   Optional. Whether to crop images to specified width and height or resize.
since: 2.9.0

get_image_tag( $id, $alt, $title, $align, $size = 'medium' )   X-Ref
Gets an img tag for an image attachment, scaling it down if requested.

The {@see 'get_image_tag_class'} filter allows for changing the class name for the
image without having to use regular expressions on the HTML content. The
parameters are: what WordPress will use for the class, the Attachment ID,
image align value, and the size the image should be.

The second filter, {@see 'get_image_tag'}, has the HTML content, which can then be
further manipulated by a plugin to change all attribute values and even HTML
content.

return: string HTML IMG element for given image attachment
param: int          $id    Attachment ID.
param: string       $alt   Image description for the alt attribute.
param: string       $title Image description for the title attribute.
param: string       $align Part of the class name for aligning the image.
param: string|int[] $size  Optional. Image size. Accepts any registered image size name, or an array of
since: 2.5.0

wp_constrain_dimensions( $current_width, $current_height, $max_width = 0, $max_height = 0 )   X-Ref
Calculates the new dimensions for a down-sampled image.

If either width or height are empty, no constraint is applied on
that dimension.

return: int[] {
param: int $current_width  Current width of the image.
param: int $current_height Current height of the image.
param: int $max_width      Optional. Max width in pixels to constrain to. Default 0.
param: int $max_height     Optional. Max height in pixels to constrain to. Default 0.
since: 2.5.0

image_resize_dimensions( $orig_w, $orig_h, $dest_w, $dest_h, $crop = false )   X-Ref
Retrieves calculated resize dimensions for use in WP_Image_Editor.

Calculates dimensions and coordinates for a resized image that fits
within a specified width and height.

Cropping behavior is dependent on the value of $crop:
1. If false (default), images will not be cropped.
2. If an array in the form of array( x_crop_position, y_crop_position ):
- x_crop_position accepts 'left' 'center', or 'right'.
- y_crop_position accepts 'top', 'center', or 'bottom'.
Images will be cropped to the specified dimensions within the defined crop area.
3. If true, images will be cropped to the specified dimensions using center positions.

return: array|false Returned array matches parameters for `imagecopyresampled()`. False on failure.
param: int        $orig_w Original width in pixels.
param: int        $orig_h Original height in pixels.
param: int        $dest_w New width in pixels.
param: int        $dest_h New height in pixels.
param: bool|array $crop   Optional. Whether to crop image to specified width and height or resize.
since: 2.5.0

image_make_intermediate_size( $file, $width, $height, $crop = false )   X-Ref
Resizes an image to make a thumbnail or intermediate size.

The returned array has the file size, the image width, and image height. The
{@see 'image_make_intermediate_size'} filter can be used to hook in and change the
values of the returned array. The only parameter is the resized file path.

return: array|false Metadata array on success. False if no image was created.
param: string $file   File path.
param: int    $width  Image width.
param: int    $height Image height.
param: bool   $crop   Optional. Whether to crop image to specified width and height or resize.
since: 2.5.0

wp_image_matches_ratio( $source_width, $source_height, $target_width, $target_height )   X-Ref
Helper function to test if aspect ratios for two images match.

return: bool True if aspect ratios match within 1px. False if not.
param: int $source_width  Width of the first image in pixels.
param: int $source_height Height of the first image in pixels.
param: int $target_width  Width of the second image in pixels.
param: int $target_height Height of the second image in pixels.
since: 4.6.0

image_get_intermediate_size( $post_id, $size = 'thumbnail' )   X-Ref
Retrieves the image's intermediate size (resized) path, width, and height.

The $size parameter can be an array with the width and height respectively.
If the size matches the 'sizes' metadata array for width and height, then it
will be used. If there is no direct match, then the nearest image size larger
than the specified size will be used. If nothing is found, then the function
will break out and return false.

The metadata 'sizes' is used for compatible sizes that can be used for the
parameter $size value.

The url path will be given, when the $size parameter is a string.

If you are passing an array for the $size, you should consider using
add_image_size() so that a cropped version is generated. It's much more
efficient than having to find the closest-sized image and then having the
browser scale down the image.

return: array|false {
param: int          $post_id Attachment ID.
param: string|int[] $size    Optional. Image size. Accepts any registered image size name, or an array
since: 2.5.0

get_intermediate_image_sizes()   X-Ref
Gets the available intermediate image size names.

return: string[] An array of image size names.
since: 3.0.0

wp_get_registered_image_subsizes()   X-Ref
Returns a normalized list of all currently registered image sub-sizes.

return: array[] Associative array of arrays of image sub-size information,
since: 5.3.0

wp_get_attachment_image_src( $attachment_id, $size = 'thumbnail', $icon = false )   X-Ref
Retrieves an image to represent an attachment.

return: array|false {
param: int          $attachment_id Image attachment ID.
param: string|int[] $size          Optional. Image size. Accepts any registered image size name, or an array of
param: bool         $icon          Optional. Whether the image should fall back to a mime type icon. Default false.
since: 2.5.0

wp_get_attachment_image( $attachment_id, $size = 'thumbnail', $icon = false, $attr = '' )   X-Ref
Get an HTML img element representing an image attachment.

While `$size` will accept an array, it is better to register a size with
add_image_size() so that a cropped version is generated. It's much more
efficient than having to find the closest-sized image and then having the
browser scale down the image.

return: string HTML img element or empty string on failure.
param: int          $attachment_id Image attachment ID.
param: string|int[] $size          Optional. Image size. Accepts any registered image size name, or an array
param: bool         $icon          Optional. Whether the image should be treated as an icon. Default false.
param: string|array $attr {
since: 2.5.0
since: 4.4.0 The `$srcset` and `$sizes` attributes were added.
since: 5.5.0 The `$loading` attribute was added.

wp_get_attachment_image_url( $attachment_id, $size = 'thumbnail', $icon = false )   X-Ref
Get the URL of an image attachment.

return: string|false Attachment URL or false if no image is available. If `$size` does not match
param: int          $attachment_id Image attachment ID.
param: string|int[] $size          Optional. Image size. Accepts any registered image size name, or an array of
param: bool         $icon          Optional. Whether the image should be treated as an icon. Default false.
since: 4.4.0

_wp_get_attachment_relative_path( $file )   X-Ref
Get the attachment path relative to the upload directory.

return: string Attachment path relative to the upload directory.
param: string $file Attachment file name.
since: 4.4.1

_wp_get_image_size_from_meta( $size_name, $image_meta )   X-Ref
Get the image size as array from its meta data.

Used for responsive images.

return: array|false {
param: string $size_name  Image size. Accepts any registered image size name.
param: array  $image_meta The image meta data.
since: 4.4.0

wp_get_attachment_image_srcset( $attachment_id, $size = 'medium', $image_meta = null )   X-Ref
Retrieves the value for an image attachment's 'srcset' attribute.

return: string|false A 'srcset' value string or false.
param: int          $attachment_id Image attachment ID.
param: string|int[] $size          Optional. Image size. Accepts any registered image size name, or an array of
param: array        $image_meta    Optional. The image meta data as returned by 'wp_get_attachment_metadata()'.
since: 4.4.0

wp_calculate_image_srcset( $size_array, $image_src, $image_meta, $attachment_id = 0 )   X-Ref
A helper function to calculate the image sources to include in a 'srcset' attribute.

return: string|false The 'srcset' attribute value. False on error or when only one source exists.
param: int[]  $size_array    {
param: string $image_src     The 'src' of the image.
param: array  $image_meta    The image meta data as returned by 'wp_get_attachment_metadata()'.
param: int    $attachment_id Optional. The image attachment ID. Default 0.
since: 4.4.0

wp_get_attachment_image_sizes( $attachment_id, $size = 'medium', $image_meta = null )   X-Ref
Retrieves the value for an image attachment's 'sizes' attribute.

return: string|false A valid source size value for use in a 'sizes' attribute or false.
param: int          $attachment_id Image attachment ID.
param: string|int[] $size          Optional. Image size. Accepts any registered image size name, or an array of
param: array        $image_meta    Optional. The image meta data as returned by 'wp_get_attachment_metadata()'.
since: 4.4.0

wp_calculate_image_sizes( $size, $image_src = null, $image_meta = null, $attachment_id = 0 )   X-Ref
Creates a 'sizes' attribute value for an image.

return: string|false A valid source size value for use in a 'sizes' attribute or false.
param: string|int[] $size          Image size. Accepts any registered image size name, or an array of
param: string       $image_src     Optional. The URL to the image file. Default null.
param: array        $image_meta    Optional. The image meta data as returned by 'wp_get_attachment_metadata()'.
param: int          $attachment_id Optional. Image attachment ID. Either `$image_meta` or `$attachment_id`
since: 4.4.0

wp_image_file_matches_image_meta( $image_location, $image_meta, $attachment_id = 0 )   X-Ref
Determines if the image meta data is for the image source file.

The image meta data is retrieved by attachment post ID. In some cases the post IDs may change.
For example when the website is exported and imported at another website. Then the
attachment post IDs that are in post_content for the exported website may not match
the same attachments at the new website.

return: bool Whether the image meta is for this image file.
param: string $image_location The full path or URI to the image file.
param: array  $image_meta     The attachment meta data as returned by 'wp_get_attachment_metadata()'.
param: int    $attachment_id  Optional. The image attachment ID. Default 0.
since: 5.5.0

wp_image_src_get_dimensions( $image_src, $image_meta, $attachment_id = 0 )   X-Ref
Determines an image's width and height dimensions based on the source file.

return: array|false Array with first element being the width and second element being the height,
param: string $image_src     The image source file.
param: array  $image_meta    The image meta data as returned by 'wp_get_attachment_metadata()'.
param: int    $attachment_id Optional. The image attachment ID. Default 0.
since: 5.5.0

wp_image_add_srcset_and_sizes( $image, $image_meta, $attachment_id )   X-Ref
Adds 'srcset' and 'sizes' attributes to an existing 'img' element.

return: string Converted 'img' element with 'srcset' and 'sizes' attributes added.
param: string $image         An HTML 'img' element to be filtered.
param: array  $image_meta    The image meta data as returned by 'wp_get_attachment_metadata()'.
param: int    $attachment_id Image attachment ID.
since: 4.4.0

wp_lazy_loading_enabled( $tag_name, $context )   X-Ref
Determines whether to add the `loading` attribute to the specified tag in the specified context.

return: bool Whether to add the attribute.
param: string $tag_name The tag name.
param: string $context  Additional context, like the current filter name
since: 5.5.0
since: 5.7.0 Now returns `true` by default for `iframe` tags.

wp_filter_content_tags( $content, $context = null )   X-Ref
Filters specific tags in post content and modifies their markup.

Modifies HTML tags in post content to include new browser and HTML technologies
that may not have existed at the time of post creation. These modifications currently
include adding `srcset`, `sizes`, and `loading` attributes to `img` HTML tags, as well
as adding `loading` attributes to `iframe` HTML tags.
Future similar optimizations should be added/expected here.

return: string Converted content with images modified.
param: string $content The HTML content to be filtered.
param: string $context Optional. Additional context to pass to the filters.
since: 5.5.0
since: 5.7.0 Now supports adding `loading` attributes to `iframe` tags.

wp_img_tag_add_loading_attr( $image, $context )   X-Ref
Adds `loading` attribute to an `img` HTML tag.

return: string Converted `img` tag with `loading` attribute added.
param: string $image   The HTML `img` tag where the attribute should be added.
param: string $context Additional context to pass to the filters.
since: 5.5.0

wp_img_tag_add_width_and_height_attr( $image, $context, $attachment_id )   X-Ref
Adds `width` and `height` attributes to an `img` HTML tag.

return: string Converted 'img' element with 'width' and 'height' attributes added.
param: string $image         The HTML `img` tag where the attribute should be added.
param: string $context       Additional context to pass to the filters.
param: int    $attachment_id Image attachment ID.
since: 5.5.0

wp_img_tag_add_srcset_and_sizes_attr( $image, $context, $attachment_id )   X-Ref
Adds `srcset` and `sizes` attributes to an existing `img` HTML tag.

return: string Converted 'img' element with 'loading' attribute added.
param: string $image         The HTML `img` tag where the attribute should be added.
param: string $context       Additional context to pass to the filters.
param: int    $attachment_id Image attachment ID.
since: 5.5.0

wp_iframe_tag_add_loading_attr( $iframe, $context )   X-Ref
Adds `loading` attribute to an `iframe` HTML tag.

return: string Converted `iframe` tag with `loading` attribute added.
param: string $iframe  The HTML `iframe` tag where the attribute should be added.
param: string $context Additional context to pass to the filters.
since: 5.7.0

_wp_post_thumbnail_class_filter( $attr )   X-Ref
Adds a 'wp-post-image' class to post thumbnails. Internal use only.

Uses the {@see 'begin_fetch_post_thumbnail_html'} and {@see 'end_fetch_post_thumbnail_html'}
action hooks to dynamically add/remove itself so as to only filter post thumbnails.

return: string[] Modified array of attributes including the new 'wp-post-image' class.
param: string[] $attr Array of thumbnail attributes including src, class, alt, title, keyed by attribute name.
since: 2.9.0

_wp_post_thumbnail_class_filter_add( $attr )   X-Ref
Adds '_wp_post_thumbnail_class_filter' callback to the 'wp_get_attachment_image_attributes'
filter hook. Internal use only.

param: string[] $attr Array of thumbnail attributes including src, class, alt, title, keyed by attribute name.
since: 2.9.0

_wp_post_thumbnail_class_filter_remove( $attr )   X-Ref
Removes the '_wp_post_thumbnail_class_filter' callback from the 'wp_get_attachment_image_attributes'
filter hook. Internal use only.

param: string[] $attr Array of thumbnail attributes including src, class, alt, title, keyed by attribute name.
since: 2.9.0

img_caption_shortcode( $attr, $content = '' )   X-Ref
Builds the Caption shortcode output.

Allows a plugin to replace the content that would otherwise be returned. The
filter is {@see 'img_caption_shortcode'} and passes an empty string, the attr
parameter and the content parameter values.

The supported attributes for the shortcode are 'id', 'caption_id', 'align',
'width', 'caption', and 'class'.

return: string HTML content to display the caption.
param: array  $attr {
param: string $content Optional. Shortcode content. Default empty string.
since: 2.6.0
since: 3.9.0 The `class` attribute was added.
since: 5.1.0 The `caption_id` attribute was added.
since: 5.9.0 The `$content` parameter default value changed from `null` to `''`.

gallery_shortcode( $attr )   X-Ref
Builds the Gallery shortcode output.

This implements the functionality of the Gallery Shortcode for displaying
WordPress images on a post.

return: string HTML content to display gallery.
param: array $attr {
since: 2.5.0

wp_underscore_playlist_templates()   X-Ref
Outputs the templates used by playlists.

since: 3.9.0

wp_playlist_scripts( $type )   X-Ref
Outputs and enqueue default scripts and styles for playlists.

param: string $type Type of playlist. Accepts 'audio' or 'video'.
since: 3.9.0

wp_get_video_extensions()   X-Ref
Returns a filtered list of supported video formats.

return: string[] List of supported video formats.
since: 3.6.0

wp_video_shortcode( $attr, $content = '' )   X-Ref
Builds the Video shortcode output.

This implements the functionality of the Video Shortcode for displaying
WordPress mp4s in a post.

return: string|void HTML content to display video.
param: array  $attr {
param: string $content Shortcode content.
since: 3.6.0

get_previous_image_link( $size = 'thumbnail', $text = false )   X-Ref
Gets the previous image link that has the same post parent.

return: string Markup for previous image link.
param: string|int[] $size Optional. Image size. Accepts any registered image size name, or an array
param: string|false $text Optional. Link text. Default false.
since: 5.8.0

previous_image_link( $size = 'thumbnail', $text = false )   X-Ref
Displays previous image link that has the same post parent.

param: string|int[] $size Optional. Image size. Accepts any registered image size name, or an array
param: string|false $text Optional. Link text. Default false.
since: 2.5.0

get_next_image_link( $size = 'thumbnail', $text = false )   X-Ref
Gets the next image link that has the same post parent.

return: string Markup for next image link.
param: string|int[] $size Optional. Image size. Accepts any registered image size name, or an array
param: string|false $text Optional. Link text. Default false.
since: 5.8.0

next_image_link( $size = 'thumbnail', $text = false )   X-Ref
Displays next image link that has the same post parent.

param: string|int[] $size Optional. Image size. Accepts any registered image size name, or an array
param: string|false $text Optional. Link text. Default false.
since: 2.5.0

get_adjacent_image_link( $prev = true, $size = 'thumbnail', $text = false )   X-Ref
Gets the next or previous image link that has the same post parent.

Retrieves the current attachment object from the $post global.

return: string Markup for image link.
param: bool         $prev Optional. Whether to display the next (false) or previous (true) link. Default true.
param: string|int[] $size Optional. Image size. Accepts any registered image size name, or an array
param: bool         $text Optional. Link text. Default false.
since: 5.8.0

adjacent_image_link( $prev = true, $size = 'thumbnail', $text = false )   X-Ref
Displays next or previous image link that has the same post parent.

Retrieves the current attachment object from the $post global.

param: bool         $prev Optional. Whether to display the next (false) or previous (true) link. Default true.
param: string|int[] $size Optional. Image size. Accepts any registered image size name, or an array
param: bool         $text Optional. Link text. Default false.
since: 2.5.0

get_attachment_taxonomies( $attachment, $output = 'names' )   X-Ref
Retrieves taxonomies attached to given the attachment.

return: string[]|WP_Taxonomy[] List of taxonomies or taxonomy names. Empty array on failure.
param: int|array|object $attachment Attachment ID, data array, or data object.
param: string           $output     Output type. 'names' to return an array of taxonomy names,
since: 2.5.0
since: 4.7.0 Introduced the `$output` parameter.

get_taxonomies_for_attachments( $output = 'names' )   X-Ref
Retrieves all of the taxonomies that are registered for attachments.

Handles mime-type-specific taxonomies such as attachment:image and attachment:video.

return: string[]|WP_Taxonomy[] Array of names or objects of registered taxonomies for attachments.
param: string $output Optional. The type of taxonomy output to return. Accepts 'names' or 'objects'.
since: 3.5.0

is_gd_image( $image )   X-Ref
Determines whether the value is an acceptable type for GD image functions.

In PHP 8.0, the GD extension uses GdImage objects for its data structures.
This function checks if the passed value is either a resource of type `gd`
or a GdImage object instance. Any other type will return false.

return: bool True if $image is either a GD image resource or GdImage instance,
param: resource|GdImage|false $image A value to check the type for.
since: 5.6.0

wp_imagecreatetruecolor( $width, $height )   X-Ref
Create new GD image resource with transparency support

return: resource|GdImage|false The GD image resource or GdImage instance on success.
param: int $width  Image width in pixels.
param: int $height Image height in pixels.
since: 2.9.0

wp_expand_dimensions( $example_width, $example_height, $max_width, $max_height )   X-Ref
Based on a supplied width/height example, return the biggest possible dimensions based on the max width/height.

return: int[] {
param: int $example_width  The width of an example embed.
param: int $example_height The height of an example embed.
param: int $max_width      The maximum allowed width.
param: int $max_height     The maximum allowed height.
since: 2.9.0

wp_max_upload_size()   X-Ref
Determines the maximum upload size allowed in php.ini.

return: int Allowed upload size.
since: 2.5.0

wp_get_image_editor( $path, $args = array()   X-Ref
Returns a WP_Image_Editor instance and loads file into it.

return: WP_Image_Editor|WP_Error The WP_Image_Editor object on success,
param: string $path Path to the file to load.
param: array  $args Optional. Additional arguments for retrieving the image editor.
since: 3.5.0

wp_image_editor_supports( $args = array()   X-Ref
Tests whether there is an editor that supports a given mime type or methods.

return: bool True if an eligible editor is found; false otherwise.
param: string|array $args Optional. Array of arguments to retrieve the image editor supports.
since: 3.5.0

_wp_image_editor_choose( $args = array()   X-Ref
Tests which editors are capable of supporting the request.

return: string|false Class name for the first editor that claims to support the request.
param: array $args Optional. Array of arguments for choosing a capable editor. Default empty array.
since: 3.5.0

wp_plupload_default_settings()   X-Ref
Prints default Plupload arguments.

since: 3.4.0

wp_prepare_attachment_for_js( $attachment )   X-Ref
Prepares an attachment post object for JS, where it is expected
to be JSON-encoded and fit into an Attachment model.

return: array|void {
param: int|WP_Post $attachment Attachment ID or object.
since: 3.5.0

wp_enqueue_media( $args = array()   X-Ref
Enqueues all scripts, styles, settings, and templates necessary to use
all media JS APIs.

param: array $args {
since: 3.5.0

get_attached_media( $type, $post = 0 )   X-Ref
Retrieves media attached to the passed post.

return: WP_Post[] Array of media attached to the given post.
param: string      $type Mime type.
param: int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
since: 3.6.0

get_media_embedded_in_content( $content, $types = null )   X-Ref
Check the content HTML for a audio, video, object, embed, or iframe tags.

return: string[] Array of found HTML media elements.
param: string   $content A string of HTML which might contain media elements.
param: string[] $types   An array of media types: 'audio', 'video', 'object', 'embed', or 'iframe'.
since: 3.6.0

get_post_galleries( $post, $html = true )   X-Ref
Retrieves galleries from the passed post's content.

return: array A list of arrays, each containing gallery data and srcs parsed
param: int|WP_Post $post Post ID or object.
param: bool        $html Optional. Whether to return HTML or data in the array. Default true.
since: 3.6.0

get_post_gallery( $post = 0, $html = true )   X-Ref
Check a specified post's content for gallery and, if present, return the first

return: string|array Gallery data and srcs parsed from the expanded shortcode.
param: int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
param: bool        $html Optional. Whether to return HTML or data. Default is true.
since: 3.6.0

get_post_galleries_images( $post = 0 )   X-Ref
Retrieve the image srcs from galleries from a post's content, if present

return: array A list of lists, each containing image srcs parsed.
param: int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`.
since: 3.6.0

get_post_gallery_images( $post = 0 )   X-Ref
Checks a post's content for galleries and return the image srcs for the first found gallery

return: string[] A list of a gallery's image srcs in order.
param: int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`.
since: 3.6.0

wp_maybe_generate_attachment_metadata( $attachment )   X-Ref
Maybe attempts to generate attachment metadata, if missing.

param: WP_Post $attachment Attachment object.
since: 3.9.0

attachment_url_to_postid( $url )   X-Ref
Tries to convert an attachment URL into a post ID.

return: int The found post ID, or 0 on failure.
param: string $url The URL to resolve.
since: 4.0.0

wpview_media_sandbox_styles()   X-Ref
Returns the URLs for CSS files used in an iframe-sandbox'd TinyMCE media view.

return: string[] The relevant CSS file URLs.
since: 4.0.0

wp_register_media_personal_data_exporter( $exporters )   X-Ref
Registers the personal data exporter for media.

return: array[] Updated array of personal data exporters.
param: array[] $exporters An array of personal data exporters, keyed by their ID.

wp_media_personal_data_exporter( $email_address, $page = 1 )   X-Ref
Finds and exports attachments associated with an email address.

return: array An array of personal data.
param: string $email_address The attachment owner email address.
param: int    $page          Attachment page.
since: 4.9.6

_wp_add_additional_image_sizes()   X-Ref
Add additional default image sub-sizes.

These sizes are meant to enhance the way WordPress displays images on the front-end on larger,
high-density devices. They make it possible to generate more suitable `srcset` and `sizes` attributes
when the users upload large images.

The sizes can be changed or removed by themes and plugins but that is not recommended.
The size "names" reflect the image dimensions, so changing the sizes would be quite misleading.

since: 5.3.0

wp_show_heic_upload_error( $plupload_settings )   X-Ref
Callback to enable showing of the user error when uploading .heic images.

return: array[] Modified settings for Plupload.js.
param: array[] $plupload_settings The settings for Plupload.js.
since: 5.5.0

wp_getimagesize( $filename, array &$image_info = null )   X-Ref
Allows PHP's getimagesize() to be debuggable when necessary.

return: array|false Array of image information or false on failure.
param: string $filename   The file path.
param: array  $image_info Optional. Extended image information (passed by reference).
since: 5.7.0
since: 5.8.0 Added support for WebP images.

wp_get_webp_info( $filename )   X-Ref
Extracts meta information about a WebP file: width, height, and type.

return: array {
param: string $filename Path to a WebP file.
since: 5.8.0

wp_get_loading_attr_default( $context )   X-Ref
Gets the default value to use for a `loading` attribute on an element.

This function should only be called for a tag and context if lazy-loading is generally enabled.

The function usually returns 'lazy', but uses certain heuristics to guess whether the current element is likely to
appear above the fold, in which case it returns a boolean `false`, which will lead to the `loading` attribute being
omitted on the element. The purpose of this refinement is to avoid lazy-loading elements that are within the initial
viewport, which can have a negative performance impact.

Under the hood, the function uses {@see wp_increase_content_media_count()} every time it is called for an element
within the main content. If the element is the very first content element, the `loading` attribute will be omitted.
This default threshold of 1 content element to omit the `loading` attribute for can be customized using the
{@see 'wp_omit_loading_attr_threshold'} filter.

return: string|bool The default `loading` attribute value. Either 'lazy', 'eager', or a boolean `false`, to indicate
param: string $context Context for the element for which the `loading` attribute value is requested.
since: 5.9.0

wp_omit_loading_attr_threshold( $force = false )   X-Ref
Gets the threshold for how many of the first content media elements to not lazy-load.

This function runs the {@see 'wp_omit_loading_attr_threshold'} filter, which uses a default threshold value of 1.
The filter is only run once per page load, unless the `$force` parameter is used.

return: int The number of content media elements to not lazy-load.
param: bool $force Optional. If set to true, the filter will be (re-)applied even if it already has been before.
since: 5.9.0

wp_increase_content_media_count( $amount = 1 )   X-Ref
Increases an internal content media count variable.

return: int The latest content media count, after the increase.
param: int $amount Optional. Amount to increase by. Default 1.
since: 5.9.0



Generated: Sat Nov 23 01:00:02 2024 Cross-referenced by PHPXref 0.7.1