我使用延迟回形针以及直接上传到S3。我的模型被称为Photo
,其附件是image
。使用带有延迟回形针的S3直接上传
使用JavaScript中的图片将图片上传到S3。该文件存储在Paperclip希望找到原始图像的位置,并将文件详细信息保存到隐藏字段中。当提交表单时,这些属性被写入到照片模式:
image_file_name image_file_size image_content_type
因为写仅凭这些属性似乎不是足以触发延迟回形针处理图像,Photo.save
后,我打电话Photo.image.reprocess!
这会得到DelayedPaperclip来创建一个新的成功处理图像的Sidekiq作业。
的问题是,当我在PhotosController
调用Photo.save
,将文件复制到从S3一temp
目录,然后再返回到S3。出现这种情况的工作,在和阻止:
[paperclip] copying image_assets/grab-original.tiff to local file /var/folders/bv/x495g9g10m7119680c9ssqmr0000gn/T/94943834d26bcb8b471f4eeb2a7f899d20141125-3895-1oqom7l
[AWS S3 200 2.601589 0 retries] get_object(:bucket_name=>"example-com-development",:key=>"image_assets/grab-original.tiff")
[paperclip] saving image_assets/grab-original.tiff
[AWS S3 200 2.47114 0 retries] put_object(:acl=>:public_read,:bucket_name=>"example-com-development",:cache_control=>"max-age=29030400",:content_length=>534472,:content_type=>"image/tiff",:data=>Paperclip::AttachmentAdapter: grab.tiff,:key=>"image_assets/grab-original.tiff")
为什么回形针复制文件下来,然后再返回?