How to Get Real Image Sizes on PHP Level in Magento

Jun 16, 2014 1139 Updated: March 28, 2019 9:18
How to Get Real Image Sizes on PHP Level in Magento

Sometimes it is necessary to know the real size of an image before rendering and displaying it on a page. Below you can see the function which returns the array of sizes (such as heigh and width) for a specific image.

Andrey_Dubina
Partner With Us Let's discuss how to grow your business. Get a Free Quote.
Talk to Andrey

Here: $path = Mage::getBaseDir(‘media’) . DS . $this->getMediaDir() . DS . $filename; – full path to the image file

This function is suitable for such modules as Animated Slider and Splashpage.

Here is an example of its usage:

Andrey Dubina
Partner With Us Looking for a partner to grow your business? We are the right company to bring your webstore to success. Talk to Andrey
Tags:

Post a new comment