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?
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.
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.
Decimal places in image sizes
Hi
I am seeing image code in pages with a source like this:
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
thanks, Matt
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.
Thank you
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.
Thank you Matt
Hi all
I changed this setting in the RTE data type but it hasnt made a difference, I must be missing something? Thanks, Matt
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.
thanks!
is working on a reply...