In PHP, I'm using an in-memory (or rather, temp in-memory) file to load an image from an external URL into a GD resource:
$file = 'php://temp/img';
copy($uri, $file);
$src_img = @imagecreatefromjpeg($file);
However, as I understand it, this file remains in memory, even though I have no use for it after imagecreatefromjpeg()
.
Is there a way to free memory used by a php://temp wrapper file?
Or atleast signal that the file is no longer used?
php://maxmemory
to set a very low memory value so the data would always be written to disk, keeping memory usage low. Although if your going to do that you might as well just use a temp file, rendering the wholephp://temp
thing pointless. – Wondering