SlideShare a Scribd company logo
1 of 26
Download to read offline
Thumbor ile on-demand
resim işleme
Pyİstanbul - 11.07.2015
Murat Çorlu
Triofan
@muratcorlu
murat.corlu@triofan.com
Resim ne zaman resize
edilmeli
● Upload ederken resize et
● Backend’de ilk lazım olduğunda resize et
● Client’ta ilk lazım olduğunda resize et
Dezavantajlar
● Görsel katmanı logic ile
karıştırmak
● Tasarımda esneklik kaybı
● Varyasyon çıkarma zorluğu
Avantajlar
● Basitlik?
Upload anında resize
Dezavantajlar
● Resmin url’i lazım olduğu anda
resim de üretiliyor
Avantajlar
● Yönetmesi kolay
● Tasarımda esneklik
İlk lazım olduğunda resize
(SORL)
Dezavantajlar
● Uzun resim url’leri
Avantajlar
● Yönetmesi kolay
● Tasarımda esneklik
● Resim üretmek gerçekten son
gerekli olduğu anda yapılıyor
İlk lazım olduğunda resize
(Client)
On-demand resim işleme
servisleri
● Cloudinary
● Imagefly
● imgix
● Prism
● ...
Thumbor
Self-hosted on-demand resim işleme
thumbor.org
Neden Thumbor
● Self-hosted, limitsiz
● Open source
● Ücretsiz
● Özellik zengini
● Python ile yazılmış
Nasıl kullanılır?
http://localhost:8080/unsafe/400/300/smart/filters:
watermark(http://my.site.com/img.png,-10,-10,50)/i.imgur.
com/h2hWy27
Resim kaynakları (Image
Loader)
● HTTP Loader
● File Loader
● MogileFS Loader
● Custom Loaders
Smart Cropping
● OpenCV kullanıyor
● Face detection
● Feature detection
Face Detection
●
Feature Detection
Lazy Smart Cropping
● İlk istekte basit croplama ile cache headersız cevap
dönülür
● Arka planda(Redis) resmin smart croplu hali hazırlanır
● Hazırlandıktan sonra cache header’ı ile asıl resim
gönderilir.
* Bonus: RemoteCV
● Brightness
● Contrast
● Colorize
● Equalize
● Filling
● Format
● Frame
● Extract-Cover
● Grayscale
● Max Bytes
● Noise
● No Upscale
● Quality
● Red-Eye
● RGB
● Round Corners
● Rotate
● Saturation
● Sharpen
● Strip ICC
● Watermark
● Convolution
● Blur
● Extract Focal Points
● GifV
● Curve
Resim Filtreleri
● WebP destekleyen tarayıcılara otomatik olarak WebP
formatında cevap dönme
● %20’ye yakın bandwidth tasarrufu
* Dikkat: URL bazlı cache ile kullanılamaz.
Otomatik WebP Desteği
Güvenlik?
http://some.server.com/unsafe/300x301/smart/path/to/image.jpg
http://some.server.com/unsafe/300x302/smart/path/to/image.jpg
http://some.server.com/unsafe/300x303/smart/path/to/image.jpg
...
http://some.server.com/unsafe/300x9999/smart/path/to/image.jpg
...
http://some.server.com/unsafe/9999x9999/smart/path/to/image.jpg
Kaynak URL:
http://some.server.com/unsafe/300x200/smart/path/to/image.jpg
1. HMAC-SHA1 (with SECURITY_KEY)
2. Base64
Sonuç:
http://some.server.
com/1234567890123456789012345678/300x200/smart/path/to/image.jpg
HMAC Metodu
Django için eklenti?
django-thumbor
<img src=”{% thumbor_url img.url width=500 height=300
smart=True %}”>
<img src=”http://thumbor-server.
com/1234567890123456789012345678/500x300/smart/pat
h/to/image.jpg”>
Upload nasıl olacak?
● /image REST API
● POST /image : Upload image
● PUT /image : Replace image
● DELETE /image : Delete image
* Authentication desteği yok
Örnek POST isteği:
curl -i -H "Content-Type: image/jpeg" -H "Slug: photo.jpg"
-XPOST http://thumbor-server/image --data-binary
"@vows/crocodile.jpg"
Thumbor Upload API
● Daha generic ve yönetilebilir bir protokol
● Nginx modülü var
● django-resto
Upload Alternatifi: WebDAV
Thumbor’u Scale etmek
● Thumbor aynı anda tek bir işlem yapabilir
● İstediğiniz kadar instance çalıştırabilirsiniz
● Nginx reverse proxy ile yük dağıtımı yapılabilir
http {
upstream thumbors {
server 127.0.0.1:8001;
server 127.0.0.1:8002;
server 127.0.0.1:8003;
}
server {
listen 80;
location / {
proxy_pass http://thumbors;
}
}
}
Soru?
Teşekkürler
@muratcorlu

More Related Content

Featured

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Featured (20)

Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 

Thumbor ile on-demand resim işleme