Paperclip: upload from url with extension

前端 未结 1 1263
臣服心动
臣服心动 2021-02-05 14:37

I would like to upload pictures from URLs by paperclip on S3 storage. I work with :

Ruby 1.9.3
Rails 3.2.6
paperclip 3.1.3
aws-sdk 1.3.9

I hav

相关标签:
1条回答
  • 2021-02-05 15:19

    Good timing. I just sent a pull request that was patched in a few hours ago (Jul 20 2012) which should make your life real easy.

    self.asset = URI.parse("http://s3.amazonaws.com/blah/blah/blah.jpg")
    

    This will download your jpeg image, ensure that the filename is blah.jpg and the content type is 'image/jpg'

    Paperclip version > 3.1.3 (you'll need to link it to github repo until it gets released).

    UPDATE: confirmed working with paperclip version >= 3.1.4

    0 讨论(0)
提交回复
热议问题