Giter Site home page Giter Site logo

图片上传到骑牛 about image HOT 8 OPEN

billie66 avatar billie66 commented on June 2, 2024
图片上传到骑牛

from image.

Comments (8)

billie66 avatar billie66 commented on June 2, 2024

http://railscasts.com/episodes/383-uploading-to-amazon-s3?view=asciicast

原理应该相似,一个封装好的 GEM

https://github.com/waynehoover/s3_direct_upload

from image.

billie66 avatar billie66 commented on June 2, 2024

看来通过 carrierwave 上传文件到云存储上,是无法得到上传进度的。若用 jquery-file-upload 把文件直接传到云上,不经应用所在服务器,就能显示文件上传进度了

from image.

billie66 avatar billie66 commented on June 2, 2024

一篇博客 http://pjambet.github.io/blog/direct-upload-to-s3/

上面文章有点儿过时,下面这篇比较新,虽然都是直传到 s3, 但能帮助理解其过程

https://github.com/blueimp/jQuery-File-Upload/wiki/Upload-directly-to-S3

把文件直传到骑牛的 Gem, https://github.com/huobazi/qiniu_direct_uploader

from image.

billie66 avatar billie66 commented on June 2, 2024

骑牛的 ruby-sdk 以及 js-sdk

http://developer.qiniu.com/docs/v6/sdk/ruby-sdk.html

http://developer.qiniu.com/docs/v6/sdk/javascript-sdk.html

先试试 qiniu_direct_uploader

from image.

billie66 avatar billie66 commented on June 2, 2024

https://devcenter.heroku.com/articles/direct-to-s3-image-uploads-in-rails

from image.

billie66 avatar billie66 commented on June 2, 2024

通过 qiniu_direct_uploader 将图片直传到骑牛后,返回的参数。

 {"etag"=>"Fl4mOeSU0xWGfJZDKqsVa4Akixo-", "fname"=>"cover.jpg", "fsize"=>"213680", "mimeType"=>"image/jpeg", "imageInfo"=>{"format"=>"jpeg", "width"=>"1800", "height"=>"2360", "colorModel"=>"ycbcr"}, "exif"=>{"ColorSpace"=>{"val"=>"sRGB", "type"=>"3"}, "Compression"=>{"val"=>"JPEG compression", "type"=>"3"}, "DateTime"=>{"val"=>"2014:12:24 10:38:43", "type"=>"2"}, "ExifVersion"=>{"val"=>"Exif Version 2.1", "type"=>"7"}, "FlashPixVersion"=>{"val"=>"FlashPix Version 1.0", "type"=>"7"}, "Orientation"=>{"val"=>"Top-left", "type"=>"3"}, "PixelXDimension"=>{"val"=>"1800", "type"=>"4"}, "PixelYDimension"=>{"val"=>"2360", "type"=>"4"}, "ResolutionUnit"=>{"val"=>"Inch", "type"=>"3"}, "Software"=>{"val"=>"Adobe Photoshop CS6 (Macintosh)", "type"=>"2"}, "XResolution"=>{"val"=>"72.0090", "type"=>"5"}, "YResolution"=>{"val"=>"72.0090", "type"=>"5"}}, "endUser"=>"", "key"=>"uploads/2015/02/13/Fl4mOeSU0xWGfJZDKqsVa4Akixo-/cover.jpg", "custom_fields"=>{"aaa"=>"1", "bbb"=>"2"}, "xyz"=>"100"}

这里的 key 值是图片存储到骑牛后的最终文件名

from image.

billie66 avatar billie66 commented on June 2, 2024

贴个文档链接,介绍了qiniu 的重定向上传和回调上传

http://lalalala.qiniudn.com/api/v6/gen-use.html

from image.

billie66 avatar billie66 commented on June 2, 2024

在上传策略中设置了过期时间, expires_in 字段,单位为秒,比如把过期时间设为 360,而上传文件比较大,文件上传时间超过过期时间,则上传不能成功,返回 401 错误码(unauthorized),把过期时间延长,则不会报错

from image.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.