Page 1 of 1

ImageMagik filling my temp dir

Posted: 2007-05-30T09:06:00-07:00
by iambaz

I recently upgraded my image gallery site to resize photos with imagemagik and magickwand for php. It worked fine until I started getting a problem with an error 28 on the site. The cause of this seems to be my servers temp directory filling up due to imagemagik. I use something like:

$resource = NewMagickWand();
MagickReadImage($resource, $_FILES['file1']['tmp_name']);
$resource = MagickTransformImage($im, '0x0', "{$newwidth}x{$newheight}" );
MagickWriteImage($resource, $name);

I presume i need some kind of line after this to delete the temporary file?

Help would be apreciated


Re: ImageMagik filling my temp dir

Posted: 2007-05-30T10:12:14-07:00
by magick
Add DestroyMagickWand() after you are done with it. This destroys any resources associated with the wand including any temporary files.

Re: ImageMagik filling my temp dir

Posted: 2007-06-01T02:44:38-07:00
by iambaz
Ah! Thanks mate

Re: ImageMagik filling my temp dir

Posted: 2007-07-18T02:32:17-07:00
by iambaz
Unfortunately this hasn't fixed my problem. We are still getting sporadic error 28 messages. This has become a major issue for us as it's crashing the site quite often.

The site is a public image gallery and people are uploading photos all thetime. Generally everything is working fine but every so often the temp dir fills up with the following files:


There is no real pattern to these crashes, but as you can see, the files fill up at the same time.

I use the above code to upload the files - complete with destroyMagickWand() after the upload code.

Any information or hints regarding my issue would be very useful. I'm starting to think it may be malicious actions, but I am unaware how to combat them if they are.

Thanks in advance

Re: ImageMagik filling my temp dir

Posted: 2008-02-05T12:26:10-07:00
by mrBlaQ
Try checking your php error logs for 'time limit exceeded' messages (your exact wording may vary) Perhaps these temp files are left over from dead processes that took too long to resize or whatever other operation you're dealing with.