Hi All,
I have a script that writes an image to my server, but I need a way to open that saved file, remove 12px height from the bottom and then resave over the original file.
I've gone through a mass of bad searches and end up with GD scripts to crop the image and then reads the imge out on the fly, but I can't find any that tell me how to save the file to the server (with the acception of image upload scripts).
Where do I go after doing this?
// image I want to resize
$file = $this->local_cache_subdir."/".$this->local_cache_file;
$img = imagecreatefromjpeg($file);
// canvas size
$h_canvas = imagesx($img);
$w_canvas = imagesy($img);
$canvas = imagecreatetruecolor($h_canvas, $w_canvas);
// new image size
$h_image = $h_canvas;
$w_image = $w_canvas-12;
// start pixel
$x_image = $h_canvas;
$y_image = $w_canvas;
imagecopyresampled($canvas, $img, $x_image, $y_image, 0, 0, $h_image, $w_image, $h_canvas, $w_canvas);
imagedestroy($img);
imagejpeg($canvas, $file, 100);
imagedestroy($canvas);
Any help welcome,
Cheers