okey, I'm not really a PHP programmer, but I'm making an image viewer for my web page. I have a function that makes thumbnails for me
So... do I need imagedestroy()?
I don't really know how PHP allocates or deallocates memory, but I'm thinking that the used memory is deallocated when the function ends. Am I wrong?
Code:
function addThumb($file) { global $dirPath; global $thumbPath; $size = getimagesize($dirPath.$file); //Image size $thumbWidth = 200; //New width. $thumbHeight = ($thumbWidth/$size[0]) * $size[1]; //New height $thumb = imagecreatetruecolor($thumbWidth, $thumbHeight); //New Image $source = imagecreatefromjpeg($dirPath.$file); //Open Image imagecopyresized($thumb, $source, 0, 0, 0, 0, $thumbWidth, $thumbHeight, $size[0], $size[1]); //resize $source and save it in $thumb imagejpeg($thumb,$thumbPath.$file); //save $thumb }
I don't really know how PHP allocates or deallocates memory, but I'm thinking that the used memory is deallocated when the function ends. Am I wrong?
Comment