I want know width and height from (images) Logo and Crest, current I use standard PHP function getimagesize in my theme
/**
* Get dimensions for image
*/
if (!function_exists('get_image_dimensions')) {
function get_image_dimensions($url)
{
$size = getimagesize($url);
$width = $size[0];
$height = $size[1];
return array('width' => $width, 'height' => $height);
}
}
Exist native function for it ?
getimagesize()
, there's no need for a WordPress function to duplicate it.getimagesize()
as well. Ifgetimagesize()
is slowing down your site, you might consider stashing its results in an option so you only need to run it once (assuming that your logo and crest don't change).