imagemagick doesn't delete tmp files

Matilda picture Matilda · Aug 9, 2012 · Viewed 8.7k times · Source

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?

Answer

Bashevis picture Bashevis · Jan 19, 2013

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.