Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: wp_calculate_image_sizes

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
1511       * @since 4.4.0
1512       *
1513       * @param string       $sizes         A source size value for use in a 'sizes' attribute.
1514       * @param string|int[] $size          Requested image size. Can be any registered image size name, or
1515       *                                    an array of width and height values in pixels (in that order).
1516       * @param string|null  $image_src     The URL to the image file or null.
1517       * @param array|null   $image_meta    The image meta data as returned by wp_get_attachment_metadata() or null.
1518       * @param int          $attachment_id Image attachment ID of the original image or 0.
1519       */
1520      return apply_filters( 'wp_calculate_image_sizes', $sizes, $size, $image_src, $image_meta, $attachment_id );
1521 }
1522
1523 /**
1524  * Determines if the image meta data is for the image source file.
1525  *
1526  * The image meta data is retrieved by attachment post ID. In some cases the post IDs may change.
1527  * For example when the website is exported and imported at another website. Then the
1528  * attachment post IDs that are in post_content for the exported website may not match
1529  * the same attachments at the new website.