WYSIWYG Editor – How to Get Different Image Sizes

imageimage-uploadmediarwdwysiwyg

I'm trying to get some responsive images working on my store using the srcset attribute and I figured one of the simplest way to do so was getting a large and a small version of the image in the backend, the problem is that the {{media url=""}} markup tag returns the URL to the full size image.

Is there a way to resize the image from the editor? Something equivalent to the resize function?

The idea is to have something like:

<img src="{{media url="wysiwyg/image.jpg"}}" srcset="{{media url="wysiwyg/small.jpg"}} 640w, {{media url="wysiwyg/large.jpg"}} 1200w" alt="" />

Without having to upload the same image 3 times

Best Answer

Unfortunately Magento does not have a mechanism for resizing media images. You'll either need to upload multiple images yourself, or implement a module that will handle this for you. You can reference the Mage_Catalog_Model_Product_Image and Varien_Image classes to see how Magento handles resizing catalog images.

Related Topic