我正在尝试创建一个蒙太奇文件,该文件包含通过Shrine(私下)上传到S3的各种缩略图。
此操作的代码驻留在Sidekiq工作程序(在Heroku中)中,该工作程序应发送带有上面处理的图像的电子邮件作为电子邮件附件。 (然后只是转储图像)
这是我的尝试:
images = []
@user.photos.first(25).each do |photo|
images << File.read(photo.image[:thumb].url)
end
processed_image = MiniMagick::Tool::Montage.new do |image|
images.each {|i| image << i}
image.tile "5x5"
image << "output.jpg"
end
attachments.inline['images.jpg'] = processed_image
尽管出现错误:
2019-11-04T18:17:59.638Z 30695 TID-ot0uksdbv警告:Errno :: ENOENT:否 这样的文件或目录@ rb_sysopen- https://mysite.s3.eu-west-1.amazonaws.com/photo/thumb/5cb924406fa8944e5279a15b46f250f6.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIJJCEGJCEVP2A%2F20191104%2Feu-west-1%2Fs3%2Faws4_request&X-Amz-Date=20191104T181759Z&X-Amz-Expires=900&X-Amz-SignedHeaders=host&X-Amz-Signature=38706b7526fd0a8095a2f387521063d4d8901c4523696ff7e1f60ae2d
似乎无法在S3处打开拇指(我混淆了上面的链接,但是当粘贴到浏览器中时,它会正确返回图像)
我试图直接在块中传递链接:
images << photo.image[:thumb].url
但是这次看来我从MiniMagick那里得到了错误
montage-im6.q16:未授权
HTTPS' @ error/delegate.c/InvokeDelegate/1717. montage-im6.q16: unable to open file
':无此类文件或目录@ error / constitute.c / ReadImage / 544。 montage-im6.q16:未经授权HTTPS' @ error/delegate.c/InvokeDelegate/1717. montage-im6.q16: unable to open file
':不允许操作@ error / constitute.c / ReadImage / 544。 montage-im6.q16:未经授权HTTPS' @ error/delegate.c/InvokeDelegate/1717. montage-im6.q16: unable to open file
':不允许操作@ error / constitute.c / ReadImage / 544。 montage-im6.q16:未经授权HTTPS' @ error/delegate.c/InvokeDelegate/1717. montage-im6.q16: unable to open file
':不允许操作@ error / constitute.c / ReadImage / 544。 montage-im6.q16:未经授权的HTTPS @ 错误/delegate.c/InvokeDelegate/1717。
不太确定如何处理。.