ok, i have a cobalt raq4 on my shelf, where i do all of my development work, before i upload a site.
i have this function
function resizeandstamp($imgfrom,$imgto,$width,$quality,$fontfile="",$text="",$textsize=8,$extra=""){
$src_img = imagecreatefromjpeg($imgfrom);
$src_width = imagesx($src_img);
$src_height = imagesy($src_img);
$dest_width = $width;
$dest_ratio = $src_width / $width;
$dest_height = ceil($src_height / $dest_ratio);
$dst_thumb = imagecreatetruecolor($dest_width,$dest_height);
imagecopyresampled($dst_thumb, $src_img, 0, 0, 0, 0, $dest_width, $dest_height, $src_width, $src_height);
if ($text != "" && $fontfile != ""){
$textcolor = imagecolorallocate($dst_thumb, 0xFF, 0xFF, 0xFF);
$midshadowcolor = imagecolorallocate($dst_thumb, 0x33, 0x33, 0x33);
$shadowcolor = imagecolorallocate($dst_thumb, 0x00, 0x00, 0x00);
imagettftext ($dst_thumb, $textsize, 0, 5, $dest_height-2, $midshadowcolor, $fontfile, $text);
imagettftext ($dst_thumb, $textsize, 0, 4, $dest_height-3, $shadowcolor, $fontfile, $text);
imagettftext ($dst_thumb, $textsize, 0, 3, $dest_height-4, $textcolor, $fontfile, $text);
};
if ($extra == "greyscale") imagecopymerged($dst_thumb, $src_img, 0, 0, 0, 0, $dest_width, $dest_height, $dest_width, $dest_height);
$newfile = $imgto;
if (imagejpeg($dst_thumb, $newfile, $quality)){
return "true";
} else {
return "false";
};
imagedestroy($dst_thumb);
imagedestroy($src_img);
unset($dest_width);
unset($dest_height);
unset($dest_ratio);
unset($src_width);
unset($src_height);
};
which works fine + dandy on the cobalt. if i upload it, i get that blanko error message (translated as an error document by the browser).
heres the code where i call it
if (is_uploaded_file($fld_file)){
$type = $fld_file_type;
if ($type == "image/jpeg" || $type == "image/pjpeg"){
$parts = explode(".",$fld_file_name);
$time = gmmktime();
$filename = $time.".".$parts[1];
$mid = $time."_mid.".$parts[1];
$thumb = $time."_thumb.".$parts[1];
resizeandstamp($fld_file,$path."/uploads/$filename",450,85,$fontfile="",$text="",$textsize=8,$extra="");
resizeandstamp($path."/uploads/$filename",$path."/uploads/$mid",200,70,$fontfile="",$text="",$textsize=8,$extra="");
resizeandstamp($path."/uploads/$mid",$path."/uploads/$thumb",130,60,$fontfile="",$text="",$textsize=8,$extra="");
$error = "The file was uploaded and resized successfully<br><br>";
} else {
$parts = explode(".",$fld_file_name);
$time = gmmktime();
$filename = $time.".".$parts[1];
copy($fld_file,$path."/uploads/$filename");
};
$db->query("INSERT INTO Media (VillaID, Filename, Mid, Thumb, Type, Size, DateTime) VALUES ('$fld_id','$filename','$mid','$thumb','".$type."','".$fld_file_size."','".gmmktime()."');");
} else {
$error = "The file did not upload...<br><br>";
};
$submit = "EDIT"; // ignore this
i resize 3 versions of the image, based on each other, but it doesnt even do the first one, it just dies.
any great ideas?