We have moved to GitHub Issues
Created by Geoff Beaumont 06 Jun 2014, 09:41:27 Updated by Geoff Beaumont 06 Jun 2014, 12:19:37
Relates to: U4-4967
The ability to set a default and/or mandatory class to be applied to all RTE images would be extremely useful. This would, for example, allow the class "slimmage" to be added for responsive image scaling.
While this could be achieved by making an editor style available for use on images, we'd then be reliant on content editors to remember to apply something which is arguably a system function from their point of view.
I'd recommend you set a class on the page where you render the rich text editor and use that as a selector for slimmage.
Did you actually look at slimmage? That's not how it works: https://github.com/imazen/slimmage. It requires specific markup - the only practical way to achieve this from the RTE is to use slimresponse (https://github.com/imazen/slimresponse), which is an httpmodule which processes all img tags with either the class "slimmage" or slimmage=true on the querystring (which would be an alternative approach, but one less flexible for other uses, IMO).
Well.. then that's stupid and they should change it. =)
Feel free to investigate how to do this, it's very low priority for us to go and figure it out (TinyMCE is pretty hairy to deal with).
Actually, it's not stupid at all - it's technically necessary. Just using a selector and then modifying the image source would result in two image requests.
I get that this isn't likely to be top of the core team's priorities though!
Hmm, after a bit of playing, however, my idea of setting the class by default ''is'' stupid, at least for most use cases.
The problem is that slimmage will resize the image to occupy the maximum width that the CSS allows (most likely 100% container width), which isn't always what you want (for example if you have a small image floated within your content). So, a global class really doesn't work and this needs to be set on a case by case by the editor.
As a side issue, slimmage doesn't play nicely with the explicitly set height and width on the querystring, but that could be got round by only outputting width (which is all that ImageProcessor requires, as we only allow resizing not cropping or changing aspect ratio in the editor), and is also something the slimmage developer is possibly changing anyway.
Type: Feature (request)
Backwards Compatible: True
Due in version: