Jump to:

5539 Posts in 1738 Topics by 1224 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Resize images on-the-fly in content?

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

Page: 1
Go to End
Author Topic: 957 Views
  • inCharge
    Community Member
    102 Posts

    Resize images on-the-fly in content? Link to this post

    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.


  • simon_w
    Forum Moderator
    471 Posts

    Re: Resize images on-the-fly in content? Link to this post

    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.

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.