I've written some code that copies a chunk of a big image to a new smaller image and saves it to the server. That all works just fine
However, I would like it to trim off any white background around the text and this is the part that doesn't work
Here is my code
$sourceImage = imagecreatefromjpeg($image);
$tempImg = imagecreatetruecolor($data[2],$data[3]);
imagecopy($tempImg,$sourceImage, 0, 0, $data[0], $data[1], $data[2], $data[3]);
imagejpeg($tempImg,$destImage,90);
imagedestroy($tempImg);
chmod($destImage,0775);
// these next two lines don't work
$original_img = imagecreatefromjpeg($destImage);
$cropped_destImage = imagecropauto($original_img , IMG_CROP_THRESHOLD, 2, 16777215);
Can anyone see what I'm doing wrong here ?
Thanks