Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Resize images on-the-fly in content?

Go to End

2 Posts   1299 Views


Community Member, 102 Posts

30 March 2011 at 11:38pm

Edited: 30/03/2011 11:38pm

How can I enable SilverStripe to resize images inserted into the TinyMCE editor? I mean SilverStripe resizing them on the server, not by setting HTML attributes.

e.g. Images in a slideshow are automatically resized on-the-fly by $photo.SetWidth. But when inserting the images into content, they need to be resized using desktop photo editing software. It's very time consuming and painstaking, with lots of steps. I trained a new client recently and they were fine with SilverStripe, but they found resizing photos difficult.

If images were represented by a shortcode (like links) instead of the raw HTML, then the CMS image insert could store the required sizes along with the image ID. (As a positive side-effect, image files could be moved/renamed in 'Files and images' and URLs automatically updated.)

Alternatively (and even easier for the user), if the required size of images for a particular content area is known (e.g. in the right column, images are always 200 wide) then that size could be a property of the field, and used to automatically resize the image when the shortcode is processed. The same result could be achieved without shortcodes by parsing the HTML and replacing image file names, but that's just nasty.

I think there was an attempt at an on-line image resize/crop feature in 'Files and Images' but it was scrapped, right? Is that coming back? A simpler alternative would be the ability to resize an image simply by entering it's new dimensions. However, on-the-fly resizing is better, because if the original is changed, all resized variants are updated automatically.



Community Member, 473 Posts

31 March 2011 at 8:07am

On the first save after they've been inserted, if the image has been given a width/height, the image gets resized. I'm not sure if that covers future resizes though.