WPDev.one
Core Function
View Source on Trac ↗

wp_image_src_get_dimensions()

wp_image_src_get_dimensions( mixed $image_src, mixed $image_meta, mixed $attachment_id = 0 )

Determines an image's width and height dimensions based on the source file.

Parameters 2 required

Name / Type Description
$image_src
string

The image source file.

Required
$image_meta
array

The image meta data as returned by 'wp_get_attachment_metadata()'.

Required
$attachment_id
int

Optional. The image attachment ID. Default 0.

Return Value

((array)
(array | false) Array with first element being the width and second element being the height, or false if dimensions cannot be determined.

Function Information

Since Version
5.5.0
Source File
wp-includes/media.php
Advertisement