When I upload a photo, my model fails validation, err well even without any validations I\'m returned this error:
/tmp/stream20100103-13830-ywmerx-0 is not r
if your are trying to upload a video, then probably, 'identify' tries to delegate the work to ffmpeg. example
identify Desktop/00-ScalingRails-Introduction.mp4 [alaa@Zero>/home/alaa]
identify: delegate failed `"ffmpeg" -v -1 -vframes %S -i "%i" -vcodec pam -an -f rawvideo -y "%u.pam" 2> "%Z"' @ error/delegate.c/InvokeDelegate/1061.
identify: unable to open image `/tmp/magick-XXHF4ImT.pam': @ error/blob.c/OpenBlob/2498
in this example, installing ffmpeg removed the error message from the list of validation errors
This is related to ImageMagick. The command_path
option needs to point to the location where identify
is installed. From the command line, you can determine this with which identify
.
$ which identify
/some/path/to/identify
Afterwards, set command_path
to that path (in config/environments/development.rb
):
Paperclip.options[:command_path] = "/some/path/to"
This happened to me when I upgraded OS X to Lion.
Solved it by...
do a brew list
to see all packages you have and save this somewhere
uninstalling homebrew (see 'Uninstallation' on this page https://github.com/mxcl/homebrew/wiki/Installation )
reinstall homebrew with the usual
ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"
reinstalling all packages brew install ghostscript
brew install imagemagick
etc for any others you have
Note, before ghostscript would reinstall I had to apply the suggestion found here: https://github.com/mxcl/homebrew/issues/6381
brew edit ghostscript
Then add the def patches
block to the bottom of the Ghostscript class:
class Ghostscript < Formula
.... existing code here ....
def patches
{ :p0 => 'http://ftp.netbsd.org/pub/NetBSD/packages/pkgsrc/print/ghostscript/patches/patch-ak' }
end
end
The above patch may be merged in by the time you read this.
After that imagemagick detected jpegs correctly again.
TL;DR completely uninstall and reinstall homebrew, ghostscript (with patch for Lion), and imagemagick
Just to say, you can also have this error message for what it means.
In my case the file size was 0 bytes length because I forgot to flush it after writing it from a Zip, and passing this resource to Paperclip.
It might be interesting to check that you can actually open the file with your preferred viewer before reading the other answer from this thread :)
that also happened to me, i tried all the method that are mentioned above. I just change the paperclip version , then everything works fine.
I had this issue when using OSX + MAMP + Passenger + Paperclip and after setting the command_path and ensuring imagemagick was properly installed via brew, properly setting the temp and upload directories for passenger to something writable, it still wouldn't work!
The solution was to edit the envvars file for MAMP in /Applications/MAMP/Library/bin/envvars and comment out the export DYLD_LIBRARY_PATH line.
That is, change the line that says
export DYLD_LIBRARY_PATH
to
# export DYLD_LIBRARY_PATH
Then restart MAMP and feel the elation when your images are properly uploading/resizing.