As I have seen today, there is no max-height set in qa-wysiwyg-upload.php
Just realized - using the function qa_upload_file_one() there (before I was using my own) - that max-height is necessary. Get a laptop and click on the image of the lady here: http://www.klaustukai.lt/477/kaip-rengtis-i-pokalbi-del-darbo#a507 (for a default laptop resolution it is too big).
I suggest:
$maxImgWidth = 900; // define maximal image width
$maxImgHeight = 600; // define maximal image height
Or set this optional in qa_opt() and the wysiwyg-plugin options.
---
Important: With the recent code, max-width is set and a max-height parameter would be ignored if max-width is set. That is why we need to check if max-height is also regarded. That is the according resize code of my custom plugin:
case "image/png":
// create image from file
$src = imagecreatefrompng($file['tmp_name']);
// get original size of uploaded image
list($width,$height) = getimagesize($file['tmp_name']);
if($width>$maxImgWidth) {
// resize the image to maxImgWidth, maintain the original aspect ratio
$newwidth = $maxImgWidth;
$newheight=($height/$width)*$newwidth;
$resizedFlag = true;
}
// consider newheight of resized dimensions, if this height is still bigger than maxHeight, resize to maxHeight
if( (!$resizedFlag && $height>$maxImgHeight) || $newheight>$maxImgHeight) {
// resize the image to maxImgHeight, maintain the original aspect ratio
$newheight = $maxImgHeight;
$newwidth=($width/$height)*$newheight;
$resizedFlag = true;
}
// height or width is greater than maxDimensions
if($resizedFlag) {
// create new image
$newImage = imagecreatetruecolor($newwidth,$newheight);
// do the image resizing by copying from the original into $newImage image
imagecopyresampled($newImage,$src,0,0,0,0,$newwidth,$newheight,$width,$height);
// write image to buffer and save in variable
ob_start(); // stdout --> buffer
imagejpeg($newImage,NULL,90); // do JPG instead of PNG
$newImageToSave = ob_get_contents(); // store stdout in $newImageToSave
ob_end_clean(); // clear buffer
// remove images from php buffer
imagedestroy($src);
imagedestroy($newImage);
}
break; // END png