I have a script that loops through a directory and edits all the images within it to certain sizes, the problem being that there are 1,000 images totaling up to 300MB.
Is there a way to remove this created image from the memory after each loop so that it doesn't count towards php memory_limit or do I just need to set a memory limit of -1?
foreach($image as $file){
// obviousment this provides a valid image resource
$new_image = Common::resizeImg($file['tmp_name'], $file['ext'], 215, 121);
imagejpeg($new_image, SERVER_ROOT."/img/media/small-".$id.$file_ext, 100);
// clear/reset this memory???
}