wp_calculate_image_sizes WordPress Filter Hook

wp_calculate_image_sizes is a filter hook that is used to adjust the dimensions of an image before it is added to the media library. This hook can be used to crop, resize, or otherwise adjust the image.

apply_filters( 'wp_calculate_image_sizes', string $sizes, string|int[] $size, string|null $image_src, array|null $image_meta, int $attachment_id ) #

Filters the output of ‘wp_calculate_image_sizes()’.


Parameters

$sizes

(string)A source size value for use in a 'sizes' attribute.

$size

(string|int[])Requested image size. Can be any registered image size name, or an array of width and height values in pixels (in that order).

$image_src

(string|null)The URL to the image file or null.

$image_meta

(array|null)The image meta data as returned by wp_get_attachment_metadata() or null.

$attachment_id

(int)Image attachment ID of the original image or 0.


Top ↑

Source

File: wp-includes/media.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
4.4.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More