Hi, I am trying to copy & resize images on a server that doesn’t have GD 2.0, just GD 1.6. I encountered errors using imagecopyresampled() and imagecreatetruecolor() which I subsequently changed to imagecopyresized() and imagecreate() repectively. Now, I don’t get any errors, the image is successfully copied to the server, but the resized image, using imagecopyresized() does not get created.
Below is my code which im running. This successfully does everything when running on 2.0, so is there a way that I can successfully create the resized image using GD 1.6?
[code=php]
$filename_tmp = $_FILES[‘img’][‘tmp_name’];
$filename = $_POST[‘img_name’].$_POST[‘img_id’].”.jpg”;
$path = “./images/projects”;
$path_thumbs = “./images/projects/thumbs”;
$file_root = $path.”/”.$filename;
$file_root_thumbs = $path_thumbs.”/”.$filename;
@is_uploaded_file($filename_tmp));
@move_uploaded_file($filename_tmp, $file_root));
@chmod(“$file_root”, 0644);
$thumbs_size = 150;
$img_src = @imagecreatefromjpeg($file_root);
$Src_Sx = @imagesx($img_src);
$Src_Sy = @imagesy($img_src);
$src_w = $Src_Sx;
$src_h = $Src_Sy;
$dst_h = $thumbs_size;
$dst_w = $Src_Sx*$dst_h/$Src_Sy;
$img_dst = imagecreate($dst_w,$dst_h);
$dxy = ($Src_Sx – $Src_Sy)/2;
$srcX = 0;
$srcY = 0;
$dstX = 0;
$dstY = 0;
imagecopyresized($img_dst,$img_src,$dstX,$dstY,$srcX,$srcY,$dst_w,$dst_h,$src_w,$src_h);
@imageJPEG($img_dst,$file_root_thumbs,95);