How to Get Real Image Sizes on PHP Level in Magento

Jun 16, 2014185Andrei 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.

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:


Partner With Us Looking for a partner that will help you to grow your business? We are the right company to develop your webstore. Feel free to get in touch with us. We will be happy to discuss your business opportunities and provide you with a Free Quote. Talk to Igor
Tags:

Post a new comment

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