Opens in a new tab
A picture of Jeff Brigman
I CODE TODAY FOR
A BETTER TOMORROW

Glossary Term

image_get_intermediate_size()

3 tags 1 category

image_get_intermediate_size() — 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.

Inputs: $post_id (int): Attachment ID. $size (string|int[]): Optional. Image size. Accepts any registered image size name, or an array of width and height values in pixels (in that order). Default ‘thumbnail’.

Returns array|false: Array of file relative path, width, and height on success. Additionally includes absolute path and URL if registered size is passed to $size parameter. False on failure. Field $file (string): Filename of image. Field $width (int): Width of image in pixels. Field $height (int): Height of image in pixels. Field $path (string): Path of image relative to uploads directory. Field $url (string): URL of image.

Term Connections

Explore related terms connected by shared tags, shared categories, and relationship phrases. This map loads only when it comes into view.

Loading term connections…