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.

Customising the CMS /

Responsive images and TinyMCE


Reply


2 Posts   829 Views

Avatar
Spaghetti

Community Member, 32 Posts

15 November 2013 at 4:21am

Hello,

I've tried various techniques for responsive images but they all seem to focus on the template side (which is all well and good when you know what images will be on the page by design) and not the user-facing side, i.e. TinyMCE.

I'm trying to achieve these things:

- Stop SS from re-sampling my images, at all, without me asking it to.

- Stop TinyMCE from adding specific widths and heights to my images.

- Specify my images using custom markup, (so that I can use javasript like picturefill.js to lazy-load the correct image for the device).

I have no idea how to do any of this. Can anyone help please?

In the long-run I really think there needs to be some decent responsive images support built-in to Silverstripe, it's becoming more and more a part of what I do and I think in this day and age it's pretty essential.

Avatar
zenmonkey

Community Member, 528 Posts

7 December 2013 at 3:44pm

There are a couple of people working on this. The big problem is how TinyMCE is hacked to support the images. Take a look at the saveInto function in the HTMLEditorField, it's where the image resize function is called. You should also be able to oveload the tag there. I've been toying with the idea of overloading or subclassing it deal with the issue