Ruby on rails Rails回形针图像保存
当使用回形针时,如果我尝试像这样输入url(在图片保存后的创建函数中Ruby on rails Rails回形针图像保存,ruby-on-rails,imagemagick,paperclip,exif,Ruby On Rails,Imagemagick,Paperclip,Exif,当使用回形针时,如果我尝试像这样输入url(在图片保存后的创建函数中 image = Magick::ImageList.new('public' + @picture.photo.url) 我得到了错误 Magick::ImageMagickError in PicturesController#create no decode delegate for this image format `public/system/photos/115/original/Kitchener-20111
image = Magick::ImageList.new('public' + @picture.photo.url)
我得到了错误
Magick::ImageMagickError in PicturesController#create
no decode delegate for this image format `public/system/photos/115/original/Kitchener-2011103100531.jpg?1321026621' @ error/constitute.c/ReadImage/532
如果我想进去
@picture.latitude = EXIFR::JPEG.new('public' + @picture.photo.url).gps_lat
来处理我得到的exif数据
Errno::ENOENT in PicturesController#create
No such file or directory - public/system/photos/116/original/Kitchener-20111031-00531.jpg?1321026744
当我尝试在rails控制台中执行photo.url时,它提供了良好的格式,但在我的控制器中,在末尾添加了一些奇怪的垃圾“?1321026621”。我如何解决这个问题?(正则表达式看起来很容易解决这个问题,但有没有比这个更好的方法)来自:
默认情况下,回形针会将时间戳参数pass:timestamp=>false
附加到附件的url
方法:
image = Magick::ImageList.new('public' + @picture.photo.url(:original, :timestamp => false))
# => "public/system/photos/115/original/Kitchener-2011103100531.jpg"
编辑:实际上,看起来他们更改了选项名称,因为这对我的回形针2.4.0不起作用。在检查我自己的源代码后,选项是:使用时间戳
,但在github上是:时间戳
-根据您使用的回形针版本选择一个
image = Magick::ImageList.new('public' + @picture.photo.url(:original, :timestamp => false))
# => "public/system/photos/115/original/Kitchener-2011103100531.jpg"