I have an app that uses Carrierwave, S3 and rmagci. more or less following http://railscasts.com/episodes/253-carrierwave-file-uploads but just upload to S3 instead of local.
I noticed the temp files in public/uploads/ does not get deleted after an image gets created. This causes my computer to feel up over time and crash.
I looked around and the only solution i found was to write a cron job to delete them http://www.imagemagick.org/discourse-server/viewtopic.php?f=2&t=15960
any idea if there is a better way to do this in the code rather than a cronjob?
As of January 2013, there is no official way to delete temporary files, so imagemagic leaves you to do it yourself. I also use a cron job that runs every 20 minutes since the temporary files are 10+ GB in size.
It means your ImageMagick installation is NOT functioning properly!
The fact that it leaves magick-* files in tmp says that ImageMagick process died and that's why it didn't delete those files. You should configure memory limits etc. Refer http://www.imagemagick.org/script/resources.php
I've had this problem for a period of time, my code issue was that I didn't use the destroy function:
$im->destroy();
When calling the destroy function it will delete the temp files that are made under the /tmp
directory.
This is for PHP and maybe it will help someone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With