jpeg - PHP imagejpeg save file doesn't work -
jpeg - PHP imagejpeg save file doesn't work -
i have php code trim white outer border , resize. when utilize imagejpeg($newimage) output browser works fine when seek save using imagejpeg($newimage, 'test.jpg') doesn't saved anywhere. help please?
$im = imagecreatefromjpeg($src); $bg = imagecolorallocate($im,$rgb,$rgb,$rgb); // set header , output image. header('content-type: image/jpeg'); imagetrim($im,$bg); $width = imagesx($im); $height = imagesy($im); $newheight = $height * $newwidth/$width; $newimage = imagecreatetruecolor($newwidth, $newheight); imagecopyresampled($newimage, $im, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); //imagejpeg($newimage); //header('content-type: image/jpeg'); imagejpeg($newimage, 'test.jpg'); imagejpeg($newimage); imagedestroy($im); imagedestroy($newimage);
just set reply in reply box problem file permissions not good. before writing file in php, not forget test place want save files using is_writable
php jpeg
Comments
Post a Comment