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

SS24, howto prevent TinyMCE from scaling/recalculating images?


Reply

5 Posts   1877 Views

Avatar
patte

3 June 2010 at 4:03am Community Member, 63 Posts

Hey guys,

does anyone know a solution to prevent TinyMCE from scaling images? And why does TinyMCE limit the image size to 600px per default??? Thats really strange. Using the correct size the images get recalculated which is not good in any way of quality..
Any ideas?

Thanks much

patte?

Avatar
swaiba

4 June 2010 at 8:06pm Forum Moderator, 1796 Posts

Yeah someone here noticed this... I am going to raise a ticket...

in the meantime there is a solution....

cms/code/ThumbnailStripField.php

change...

if($width > 600) {
   $height *= (600 / $width);
   $width = 600;
}
if($height > 600) {
   $width *= (600 / $height);
   $height = 600;
}


to.... (or some other larger number)

if($width > 1000) {
   $height *= (1000/ $width);
   $width = 1000;
}
if($height > 1000) {
   $width *= (1000/ $height);
   $height = 1000;
}

Barry

Avatar
patte

7 June 2010 at 8:08pm Community Member, 63 Posts

Hi Barry,

a perfect workaround ;-)

Thanks
patte

Avatar
schellmax

14 August 2010 at 2:49am Community Member, 126 Posts

just stumbled upon this again, had already posted a hack 2 years ago... (http://silverstripe.org/archive/show/37117?start=0#post70790)

ticket & nice solution by 'rino' to be found here:
http://open.silverstripe.org/ticket/4926

Avatar
JonoM

8 March 2013 at 8:42am Community Member, 103 Posts

That ticket contains the perfect solution - allows you to set i.e. ThumbnailStripField::setEditorMaxWidth(800); in _config.php. (SS 2.x)

Such a simple and useful addition posted 3 years ago - what a shame it was never picked up for core!