Coder Social home page Coder Social logo

resize-upload-proxy's Introduction

DEPRECATED; use attache instead

Directly upload to S3 with image resized

Option 1: Get jQuery-File-Upload client side resizing to work in your app. Good luck.

Option 2: Use Amazon Lambda - but Lambda activates after your fileupload, so there's an awkward, cache-unfriendly, in-between moment where the image is not resized yet, and you're unsure what you want to do with your hands.

Option 3: Use refile. Best, but beware of huge changes.

Option 4

  1. Deploy this app to Heroku as-is, e.g. https://resize-upload-proxy.example.com/
  2. Instead of pointing your Amazon S3 Direct Upload to your S3 bucket URL, point to https://resize-upload-proxy.example.com/?url=YOUR_BUCKET_URL&style=300x300%23 instead
  3. There's no step 3

What's happening:

When the upload (the file, the signature, the policy, etc) reaches this Rack app, the file will be resized based on params[:style] (see Paperclip docs) and submitted to your bucket url specified in params[:url].

When the image reach S3, it will already be resized in the desired dimensions.

Also, the response from S3 will be relayed back uploader - so any existing code that works with Amazon S3 Direct Upload will continue to work transparently.

CORS headers that you've meticulously set in AWS Console will be proxied transparently.

resize-upload-proxy's People

Contributors

choonkeat avatar

Stargazers

Tolia avatar Juanito Fatas avatar

Watchers

 avatar James Cloos avatar  avatar

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.