Note that there are some explanatory texts on larger screens.

plurals
  1. POWhere do the temp files go when using MiniMagick in a Ruby on Rails app?
    text
    copied!<p>I'm using MiniMagick to perform some image resizing on images uploaded through a multi-part form. I need to generate a few different types of images from the originally uploaded file. Here's the code that's performing the image processing:</p> <pre><code>// Generates a thumbnail image mm = MiniMagick::Image.open(Rails.root.join('public', 'uploads', new_url)) mm.resize(thumbnail_dimensions.join("x")) mm.write(Rails.root.join('public', 'uploads', "t_"+new_url)) // Generates cropped version mm_copy = MiniMagick::Image.open(Rails.root.join('public', 'uploads', new_url)) mm_copy.crop('200x200') mm_copy.write(Rails.root.join('public', 'uploads', "c_"+new_url)) </code></pre> <p><code>new_url</code> is the path to the image in the <code>public</code> folder. The thumbnail routine works perfectly. When the app goes to start processing the cropped version, that is where things start breaking and I can't for the life of me figure it out. I receive the following error when from this code:</p> <pre><code>No such file or directory - /tmp/mini_magick20110627-10055-2dimyl-0.jpg </code></pre> <p>I read some stuff about possible race conditions with the garbage collector in Rails but I wasn't able to resolve the issue. I tried this from the console as well and can create MiniMagick instances but receive the <code>No such file</code> error there as well. At this point, I have no idea where to go so I'm hoping someone here has some helpful suggestions. Thanks for your help!</p> <p><strong>Details</strong>:</p> <ul> <li>OS: Ubuntu (Lucid Lynx)</li> <li>Rails Version: 3.0.7</li> <li>Ruby Version: 1.8.7</li> <li>MiniMagick Version: 3.3</li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload