Jump to:

5450 Posts in 1672 Topics by 1197 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: 900 Views
  • inCharge
    Avatar
    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.

    Thanks,
    Jules

  • simon_w
    Avatar
    Forum Moderator
    467 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.

    900 Views
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.