as I said I could isolate the part that messes with the pic.
I could put it into an if statement to resample only if $height_orig > $maxH or $width_orig > $maxW
but if that statement isn't used, then the image won't be created.
it looks like I have to put a function outside that statement that could replace the imagecopyresampled
if($height_orig > $maxH OR $width_orig > $maxW){
$image_p = imagecreatetruecolor($fwidth, $blank_height);
$white = imagecolorallocate($image_p, $colorR, $colorG, $colorB);
imagefill($image_p, 0, 0, $white);
switch($filetype){
case "gif":
$image = @imagecreatefromgif($_FILES[$fileName]['tmp_name']);
break;
case "jpg":
$image = @imagecreatefromjpeg($_FILES[$fileName]['tmp_name']);
break;
case "jpeg":
$image = @imagecreatefromjpeg($_FILES[$fileName]['tmp_name']);
break;
case "png":
$image = @imagecreatefrompng($_FILES[$fileName]['tmp_name']);
break;
}
@imagecopyresampled($image_p, $image, 0, $top_offset, 0, 0, $fwidth, $fheight, $width_orig, $height_orig);
}
// here would come a function to replace imagecopyresampled