Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Will imagedestroy() delete from disc

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.

like image 353
Jake Avatar asked Feb 17 '23 12:02

Jake


1 Answers

No just in memory.

From the manual

imagedestroy() frees any memory associated with image image.

Use unlink() to delete a file

like image 50
Ibu Avatar answered Feb 23 '23 00:02

Ibu