Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
GuruSP - Solucionando o problema de Uploads em...
Search
Rafael Macedo
June 21, 2014
Programming
120
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
GuruSP - Solucionando o problema de Uploads em Apps no Heroku
Rafael Macedo
June 21, 2014
More Decks by Rafael Macedo
See All by Rafael Macedo
Modularização de código JS
macedorafael
0
250
TDC 2014 - Solucionando o problema de Uploads em Apps no Heroku
macedorafael
1
170
Aplicações Realtime com XMPP
macedorafael
3
220
Web in the cloud with ruby
macedorafael
2
400
Other Decks in Programming
See All in Programming
Vue × Nuxt × Oxc どこまで使える?実運用の現在地
andpad
0
310
Mujeres en SEO Summit 2026 - Greatest Disaster Hits en Web Performance
guaca
0
210
メソッドのジェネリクスでGoの夢は広がるか? / Kyoto.go #65
utgwkk
3
990
「なぜそう決めたのか」を残し続ける仕組み ― Notion AI カスタムエージェント × Slack連携による設計判断の自動記録 - NIKKEI Tech Talk #47
niftycorp
PRO
0
240
技術記事、 専門家としてのプログラマ、 言語化
mizchi
13
6.6k
例外の正しい扱い方 そのエラー try-catchして大丈夫?
jinwatanabe
0
290
LaravelLive Japan の裏方のすべて — 第188回 PHP勉強会@東京 (2026-06-24)
suguruooki
2
130
1B+ /day規模のログを管理する技術
broadleaf
0
120
Language Server 使ってる? 〜VSCode と Zed の場合〜 / Are you using a Language Server? ~For VS Code and Zed~
handlename
0
810
不変条件と整合性境界—ビジネスが決める設計判断と実現パターン / Invariants and Consistency Boundaries
nrslib
14
5.9k
エンジニアと一緒にテストコードの設計と実装を改善した話
mototakatsu
0
230
ふつうのFeature Flag実践入門
irof
8
4.2k
Featured
See All Featured
The Curious Case for Waylosing
cassininazir
1
410
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
320
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
220
[SF Ruby Conf 2025] Rails X
palkan
2
1.1k
A designer walks into a library…
pauljervisheath
211
24k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
56k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1k
Paper Plane (Part 1)
katiecoart
PRO
0
9.3k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.4k
Writing Fast Ruby
sferik
630
63k
The Cult of Friendly URLs
andyhume
79
6.9k
Transcript
Solucionando o problema de Uploads em Apps no Heroku
@macedorafael http://github.com/macedo Rafael Macedo
@macedorafael http://github.com/macedo Macedo
backend…
…com chapéu de front
None
None
None
“O que pode dar errado num mero upload de uma
foto?”
None
30 segundos
! ! ! ! Unicorn Rails AWS S3 Image Magick
Browser
! ! ! ! Unicorn Rails AWS S3 Image Magick
Browser
! ! ! ! Unicorn Rails AWS S3 Image Magick
Browser
! ! ! ! Unicorn Rails AWS S3 Image Magick
Browser
! ! ! ! Unicorn Rails AWS S3 Image Magick
Browser
! ! ! ! Unicorn Rails AWS S3 Image Magick
Browser
None
…
! ! ! ! Unicorn Rails AWS S3 Image Magick
Browser ! ! ! ! Resque/Sidekiq Worker
! ! ! ! Unicorn Rails AWS S3 Image Magick
Browser ! ! ! ! Resque/Sidekiq Worker
! ! ! ! Unicorn Rails AWS S3 Image Magick
Browser ! ! ! ! Resque/Sidekiq Worker
! ! ! ! Unicorn Rails AWS S3 Image Magick
Browser ! ! ! ! Resque/Sidekiq Worker
! ! ! ! Unicorn Rails AWS S3 Image Magick
Browser ! ! ! ! Resque/Sidekiq Worker
! ! ! ! Unicorn Rails AWS S3 Image Magick
Browser ! ! ! ! Resque/Sidekiq Worker
! ! ! ! Unicorn Rails AWS S3 Image Magick
Browser ! ! ! ! Resque/Sidekiq Worker
! ! ! ! Unicorn Rails AWS S3 Image Magick
Browser ! ! ! ! Resque/Sidekiq Worker
! ! ! ! Unicorn Rails AWS S3 Image Magick
Browser ! ! ! ! Resque/Sidekiq Worker
! ! ! ! Unicorn Rails AWS S3 Image Magick
Browser ! ! ! ! Resque/Sidekiq Worker
heroku addons
None
Blitline
Blitline Transloadit
Blitline Transloadit Cloudinary
Blitline Transloadit Cloudinary ✔
http://cloudinary.com
None
None
upload
None
•JPG, PNG, GIF, BMP, ICO, TIFF and PDF
•JPG, PNG, GIF, BMP, ICO, TIFF and PDF •Secure HTTP
upload API
•JPG, PNG, GIF, BMP, ICO, TIFF and PDF •Secure HTTP
upload API •Upload from your server or directly from the browser
storage
None
•Cloud-based persistent storage
•Cloud-based persistent storage •Highly available redundant storage
•Cloud-based persistent storage •Highly available redundant storage •S3
delivery
None
•Fast delivery (CDN)
•Fast delivery (CDN) •Smart caching
image transformation/ manipulation
None
resize
resize filter
resize filter crop
resize filter crop rotate
resize filter crop rotate face detection
resize filter crop rotate face detection chained transformation …
{"public_id"=>"fe23qemppmcorq0grmfv", "version"=>1403326723, "signature"=>"4e1a7bb2e3f3eb05eed25eed10cb09807561a764", "width"=>533, "height"=>300,
"format"=>"jpg", "resource_type"=>"image", "created_at"=>"2014-‐06-‐21T04:58:43Z", "bytes"=>13895, "type"=>"upload", "etag"=>"30b1c1b426db36b8e8c12d15d629fdb5", "url"=>"http://res.cloudinary.com/hxjx3jqm7/image/upload/v1403326723/ fe23qemppmcorq0grmfv.jpg", "secure_url"=>"https://res.cloudinary.com/hxjx3jqm7/image/upload/v1403326723/ fe23qemppmcorq0grmfv.jpg"}
{"public_id"=>"fe23qemppmcorq0grmfv", "version"=>1403326723, "signature"=>"4e1a7bb2e3f3eb05eed25eed10cb09807561a764", "width"=>533, "height"=>300,
"format"=>"jpg", "resource_type"=>"image", "created_at"=>"2014-‐06-‐21T04:58:43Z", "bytes"=>13895, "type"=>"upload", "etag"=>"30b1c1b426db36b8e8c12d15d629fdb5", "url"=>"http://res.cloudinary.com/hxjx3jqm7/image/upload/v1403326723/ fe23qemppmcorq0grmfv.jpg", "secure_url"=>"https://res.cloudinary.com/hxjx3jqm7/image/upload/v1403326723/ fe23qemppmcorq0grmfv.jpg"}
http://res.cloudinary.com/hxjx3jqm7/image/ upload/v1403326723/ fe23qemppmcorq0grmfv.jpg
http://res.cloudinary.com/hxjx3jqm7/image/ upload/v1403326723/ fe23qemppmcorq0grmfv.jpg
http://res.cloudinary.com/hxjx3jqm7/image/ upload/v1403326723/ fe23qemppmcorq0grmfv.jpg http://res.cloudinary.com/hxjx3jqm7/image/ upload/w_160,h_160,c_thumb,g_face/ fe23qemppmcorq0grmfv.jpg
http://res.cloudinary.com/hxjx3jqm7/image/ upload/v1403326723/ fe23qemppmcorq0grmfv.jpg http://res.cloudinary.com/hxjx3jqm7/image/ upload/w_160,h_160,c_thumb,g_face/ fe23qemppmcorq0grmfv.jpg
None
gem 'cloudinary'
# config/cloudinary.yml development: cloud_name:
“sample” api_key: “912739217312873” api_secret: “a123=asdaszad34dsf”
cl_image_tag(“e23qemppmcorq0grmfv.jpg”,
width: 160, height: 160, crop: fill, effect: ”sepia” )
cl_image_tag(“e23qemppmcorq0grmfv.jpg”,
effect: )
cl_image_tag(“e23qemppmcorq0grmfv.jpg”,
width: 100, height: 150, effect: :pixelate)
cl_image_tag(“e23qemppmcorq0grmfv.jpg”,
cl_image_tag(“e23qemppmcorq0grmfv.jpg”,
class ImageUploader < CarrierWave::Uploader::Base include Cloudinary::CarrierWave
version :standard do process :resize_to_fill => [100, 150, :fill] cloudinary_transformation quality: 80 end version :thumbnail do process :eager => true cloudinary_transformation transformation: [ { width: 100, height: 100, crop: :thumb, gravity: :face }, { overlay: ”watermark”, width: 30, hgravity: :south_east, x: 5, y: 5 } ] end end
class ImageUploader < CarrierWave::Uploader::Base include Cloudinary::CarrierWave
version :standard do process :resize_to_fill => [100, 150, :fill] cloudinary_transformation quality: 80 end version :thumbnail do process :eager => true cloudinary_transformation transformation: [ { width: 100, height: 100, crop: :thumb, gravity: :face }, { overlay: ”watermark”, width: 30, hgravity: :south_east, x: 5, y: 5 } ] end end
class ImageUploader < CarrierWave::Uploader::Base include Cloudinary::CarrierWave
version :standard do process :resize_to_fill => [100, 150, :fill] cloudinary_transformation quality: 80 end version :thumbnail do process :eager => true cloudinary_transformation transformation: [ { width: 100, height: 100, crop: :thumb, gravity: :face }, { overlay: ”watermark”, width: 30, hgravity: :south_east, x: 5, y: 5 } ] end end
class ImageUploader < CarrierWave::Uploader::Base include Cloudinary::CarrierWave
version :standard do process :resize_to_fill => [100, 150, :fill] cloudinary_transformation quality: 80 end version :thumbnail do process :eager => true cloudinary_transformation transformation: [ { width: 100, height: 100, crop: :thumb, gravity: :face }, { overlay: ”watermark”, width: 30, hgravity: :south_east, x: 5, y: 5 } ] end end
class ImageUploader < CarrierWave::Uploader::Base include Cloudinary::CarrierWave
version :standard do process :resize_to_fill => [100, 150, :fill] cloudinary_transformation quality: 80 end version :thumbnail do process :eager => true cloudinary_transformation transformation: [ { width: 100, height: 100, crop: :thumb, gravity: :face }, { overlay: ”watermark”, width: 30, hgravity: :south_east, x: 5, y: 5 } ] end end
class ImageUploader < CarrierWave::Uploader::Base include Cloudinary::CarrierWave
version :standard do process :resize_to_fill => [100, 150, :fill] cloudinary_transformation quality: 80 end version :thumbnail do process :eager => true cloudinary_transformation transformation: [ { width: 100, height: 100, crop: :thumb, gravity: :face }, { overlay: ”watermark”, width: 30, hgravity: :south_east, x: 5, y: 5 } ] end end
class Advertisement < ActiveRecord::Base ... mount_uploader
:image, ImageUploader ... end
= form_for(:advertisement) do |f| = f.hidden_field(:image_cache)
= f.file_field(:image)
None
# app/assets/javascripts/application.js //= require cloudinary
= form_for(:advertisement) do |f| ...
= cloudinary_js_config = f.cl_image_upload(:image) ..
= form_for(:advertisement) do |f| ...
= cloudinary_js_config = f.cl_image_upload(:image) ..
= form_for(:advertisement) do |f| ...
= cloudinary_js_config = f.cl_image_upload(:image) ..
None
$$$
None
10 GB Storage
10 GB Storage 40 GB Bandwidth
Cloudinary
$35
S3
$7
None
None
$7
$42
Conclusão
“O que pode dar errado num mero upload de uma
foto?”
Muita coisa!
None
Processamento background
Processamento background Direct Upload
None
OBRIGADO
OBRIGADO ?