probablycorey/mini_magick — Issue #69: No such file or directory - identify -ping /tmp/somefile
Author: mlainez
Created: 2012-01-12 17:56:33+00:00
State: open

Hi,

I've been struggling on an error we have on our staging server and I'd hope anybody could help me.

We are using **mini_magick 3.4** together with **ImageMagick 6.6.9-7**

Carrierwave was configured to send images through s3 but I don't think this is relevant (correct me if it is :)

We upload the image file by sending it through ajax in the post raw data and grab it in this controller action:

```ruby
def create
filename = params[:qqfile]
attachment = create_file_to_upload(request.body, filename)
content = File.open(attachment.path)
current_user.media.create(:attachment => content)
attachment.delete
render :json => {success: true}, :status => 200
end
```

The create_file_to_upload method uses a tempfile to store the request raw data payload:

```ruby
def create_file_to_upload(body, name)
basename = File.basename(name)
extension = File.extname(name)
file = Tempfile.new([basename, extension])
file.binmode
file.write(body.read)
file.close
file
end
```

It works great in development and test environment but however, on our staging server, it fails with:

```
Completed 500 Internal Server Error in 29ms

Errno::ENOENT (No such file or directory - identify -ping /tmp/mini_magick20120112-14991-1gw63m2.png):
app/controllers/media_controller.rb:6:in `create'
```

I've checked that the identify command was accessible to the user with which the app is being run and it is. I have also run the command in a terminal on our server and it works like a charm.

I'm a bit lost and would be open to any suggestion, so if you have a few minutes to think about this or to point me in any direction, I'd really appreciate it.

Thanks