Get Free Audit

How to Get Real Image Sizes on PHP Level in Magento

Jun 16, 2014

458 Andrei Danilchyk

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.

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

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:

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

Post a new comment

BelVG Newsletter
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.
Email *