1

I'm using Paperclip, ImagMagick, Rmagick, Amazon-s3

I'm getting this error when getting an image from url and after custom resizing image replacing the changed image to amazon.

Magick::ImageMagickError (no encode delegate for this image format //s3.amazonaws.com/beu-dev/temp_images/final_images/000/000/377/original/template_37720121205-5921-99989h.png' @ error/constitute.c/WriteImage/1153): app/models/temp_image.rb:38:inwrite' line#38 is last line before end of this method

def reprocess_final_image
    image_file_url = self.final_image.url(:original).split('?')[0]
    thumb = Magick::Image.read(image_file_url).first
    thumb.format = "PNG"
    thumb.crop_resized!(240,200, Magick::NorthWestGravity)
    **thumb.write(image_file_url)** ***Line#38***
  end

Note: One more thing This code works perfectly when using system file system, but when started using amazon s3 Error happening

4

2 回答 2

0

问题解决了。
1.勾选“识别-列表格式”

如果您在列表中没有看到.jpeg 格式。然后您需要添加.jpeg 库


curl -O http://www.ijg.org/files/jpegsrc.v8c.tar.gz

tar zxvf jpegsrc.v8c.tar.gz
cd jpeg-8c/
./configure
make

Sudo make install
现在重新安装imagemagick然后一切正常。

于 2015-02-09T05:00:29.507 回答
0

我认为您需要使用本地文件名而不是 URL。Imagemagick 不能只通过 http 将文件写入 URL。要替换源文件,您需要使用 Amazon S3 API。

thumb.crop_resized!(240,200, Magick::NorthWestGravity)
thumb.write(local_temp_file_name)

# abstract Amazon S3 API. Use your favorite API
S3Object.store(local_temp_file_name, open(local_temp_file_name)) 
于 2012-12-05T15:18:38.803 回答