function png2jpg($originalFile, $outputFile, $quality) {
$image = imagecreatefrompng($originalFile);
imagejpeg($image, $outputFile.'.jpg', $quality);
imagedestroy($image);
}
I'm using this for my image compression, but i keep finding my file I save deleted. Does imagedestroy() cause this to save memory or will it also delete the output file.
No just in memory.
From the manual
imagedestroy() frees any memory associated with image image.
Use unlink() to delete a file
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With