Magento WYSIWYG thumbnail processing optimization

In a project I had several administrators working on Magento CE 1.7 content when suddenly a spike came that almost took a site down.

When investigating I found out the site had many (thousands) of photos put in root dir in WYSIWYG editor. Apparently magento generates all thumbnails for CMS on the fly. In other words it takes the folder, reads all imgs file by file, resizes it in a thumbnail file, reads output file to GD2 object and then this object gets returned to the browser.

If we take into consideration we have 1000 images, 5 admins working on a CMS and average of 2 images per article, we get 10.000 request for just one article per admin. Its simply too much and servers for magento are not cheap this days 🙂


First we check


And you’ll want to rewrite it to something like this






Thats basically it. However if you do not wish to empty your thumbs folder by hand (via ssh or ftp) you might want to add clean thumbnails cache button.


First add a button to the template.



We call $this->getCleanWysiwygThumbnailsUrl()

You will want to extend / overwrite app/code/core/Mage/Adminhtml/Block/Cache/Additional.php

To get something like this


And add function to clear delete files in app/code/Mage/Adminhtml/controllers/CacheController.php

Please note that this works for files and I havent tested it on db file storage.



Leave a Reply

Your email address will not be published. Required fields are marked *

Please prove me that you are not spamer :) * Time limit is exhausted. Please reload CAPTCHA.