If you want to resize uploaded images on the fly (to avoid users quota filling up, unexperienced users uploading their 5megapix holiday photos or whatever) then I've made this little modification. It only requires you to have ImageMagick installed. Uses command line so not the most secure..
Insert the following code in FCKeditor/editor/filemanager/browser/mcpuk/connectors/php/commands/FileUpload.php
(I put it on line 102)
// resize image using ImageMagick
if ($_FILES['NewFile']['size']>1048576) // max 1 MB images
{
$file = $_FILES['NewFile']['tmp_name'];
exec("/usr/local/bin/identify -format \"%w\n%h\" \"".$file."\"", $info);
if ($info[0] > $info[1]) // width bigger than height
if ($info[0] > 1024)
exec("/usr/local/bin/convert -resize 1024 \"".$file."\" \"".$file."\"");
else // height is larger
if ($info[1] > 768)
exec("/usr/local/bin/convert -resize 768 \"".$file."\" \"".$file."\"");
}
Modify the parameters as you see fit. You may also have to edit the path to IM.
It is working, but I get an 'Invalid XML response' that I am trying to get rid of. Apart from that it works fine. If someone knows why that happens then please share!
Insert the following code in FCKeditor/editor/filemanager/browser/mcpuk/connectors/php/commands/FileUpload.php
(I put it on line 102)
// resize image using ImageMagick
if ($_FILES['NewFile']['size']>1048576) // max 1 MB images
{
$file = $_FILES['NewFile']['tmp_name'];
exec("/usr/local/bin/identify -format \"%w\n%h\" \"".$file."\"", $info);
if ($info[0] > $info[1]) // width bigger than height
if ($info[0] > 1024)
exec("/usr/local/bin/convert -resize 1024 \"".$file."\" \"".$file."\"");
else // height is larger
if ($info[1] > 768)
exec("/usr/local/bin/convert -resize 768 \"".$file."\" \"".$file."\"");
}
Modify the parameters as you see fit. You may also have to edit the path to IM.
It is working, but I get an 'Invalid XML response' that I am trying to get rid of. Apart from that it works fine. If someone knows why that happens then please share!