Imagemagick does not delete tmp files

I have an application 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 that temporary files in public / uploads / are not deleted after creating the image. It makes my computer feel over time and crash.

I looked around and the only solution I found was to write a cron task to remove 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 code and not in cronjob?

+4
source share
4 answers

As of January 2013, there is no official way to delete temporary files, so imagemagic leaves you to do it yourself. I also use the cron job, which runs every 20 minutes, as temporary files are 10+ GB in size.

+4
source

This means that your ImageMagick installation is NOT working properly!

The fact that he leaves the magick- * files in tmp indicates that the ImageMagick process has died and why he did not delete these files. You must adjust the memory limits, etc. Contact http://www.imagemagick.org/script/resources.php

+5
source

I had this problem for a certain period of time, my problem with the code was that I did not use the destroy function:

$im->destroy(); 

When the destroy function is called, it deletes temporary files created in the /tmp . This is for PHP, and maybe this will help someone.

+2
source

It is always best to use a task-based approach and not clog the runtime with material removal. just run the task once a day.

+1
source

All Articles