Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I am seeing image code in pages with a source like this:
<p><img src="/media/oh4dubgo/be-considerate-on-the-water.jpg?width=500&height=281.25" alt="Image with text reading be considerate on the water" width="500" height="281.25"></p>
The max width in the settings for the image is 500px
The resizing is leading to decimal places in the image width which is invalid html because it should be an integer.
is there a setting somewhere to stop the decimal places being added?
any help gratefully received
Can you resize the image? I can't imagine .25 of a pixel would matter that much.
The easiest fix is to disable the maximum size for inserted images in the settings for the RTE datatype. The images may come in at large sizes, but resizing the image in the RTE uses integers.
If you want to leave the maximum size, it gets a little more complicated. For example, you could do something like adding an RTE cleanup step to the content saving event that uses a regex to remove the decimals. I probably have some examples that would get you close on this, but it's a little involved.
You could also create your own media file system that handles all media requests and do this work there. We actually do this and use a CDN for all of our images instead of storing them on the file system. It is by far the most flexible solution but is also by far the most complex.
and sometimes the easiest can be best - as we have an approval process for content so we can pick up the inevitable huge images before they are published.
I changed this setting in the RTE data type but it hasnt made a difference, I must be missing something?
First I'd confirm that you are editing the correct data type. Sometimes a new datatype is created depending on how the datatype is added to a doctype. It's probably easiest to go to a content node using the datatype you are trying to modify and go to the Info and click the link to the doctype in the General box. That should open the infinite editor slideout. Then find the property...you get the idea.
Also, this won't fix existing images, only newly added images.
Other than that, I'd start asking questions like, what version are you running? I can install a blank instance and do some testing for you.
Thank you! that was exactly it, two datatypes with very similar names and I had done the wrong one.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted