SlideShare a Scribd company logo
1 of 31
Spreadshirt
PoC Rendering
Spreadshirt Product Images
with Cloudinary
Martin Breest
Spreadshirt
Agenda
2
• Spreadshirt product image generation explained
• Cloudinary explained
• Rendering Spreadshirt product images with Cloudinary
Spreadshirt 3
Spreadshirt Product Image
Generation Explained
Spreadshirt
Product Image Explained
4
Product image:
http://image.spreadshirtmedia.net/image-server/v1/products/200636457/views/1,width=100.png
Product image
ProductType image
Design image
consists of
Spreadshirt
Product Image Rendering Explained
5
Image Server
Request product image
Product
Data
Product
Type
Data
Design
Data
Product
Type View
Image
Design
Image
Loads data from API
and file system
Product data: http://www.spreadshirt.de/api/v1/shops/205909/products/200636457
ProductType data: http://www.spreadshirt.de/api/v1/shops/205909/productTypes/813
Design data: http://www.spreadshirt.de/api/v1/shops/205909/designs/m12720381-2
ProductType View image:
http://image.spreadshirtmedia.net/image-server/v1/productTypes/813/views/1/appearances/366
Design image:
http://image.spreadshirtmedia.net/image-server/v1/designs/12720381
Spreadshirt
Design Positioning on Product Image
6
View width and height
from ProductType
PrintArea offset x and y
from ProductType
Design offset x and y
from Product’s DesignConfiguration
Design width and height
from Product’s DesignConfiguration
Spreadshirt
Design Position Calculation
7
int defaultImageSize = 600;
String productId = "200636457";
String viewId = "1”;
Product product = loadSpreadshirtProduct(productId);
DesignConfiguration config = (DesignConfiguration)product.configurations.get(0);
ProductType productType = loadSpreadshirtProductType(product.productType.id);
View view = productType.getView(viewId);
ViewMap viewMap = view.getViewMap(config.printArea.id);
double viewScaleX = (double) defaultImageSize / view.size.width;
double viewScaleY = (double) defaultImageSize / view.size.height;
double viewMapX = viewMap.offset.x * viewScaleX;
double viewMapY = viewMap.offset.y * viewScaleY;
double designConfigurationOffsetX = config.offset.x * viewScaleX;
double designConfigurationOffsetY = config.offset.y * viewScaleY;
double designConfigurationWidth = config.content.svg.image.width * viewScaleX;
double designConfigurationHeight = config.content.svg.image.height * viewScaleY;
int x = (int) (viewMapX + designConfigurationOffsetX);
int y = (int) (viewMapY + designConfigurationOffsetY);
int width = (int) (designConfigurationWidth);
int height = (int) (designConfigurationHeight);
Spreadshirt 8
Cloudinary Explained
Spreadshirt
Cloudinary Features
9
Powerful image retrieval
and manipulation API
Nice image management
admin UI
Various integrations for
fetching source images
Spreadshirt
Cloudinary Infrastructure
10
Processes data on AWS EC2
Stores data on AWS S3
Caches data on AKAMAI CDN
Spreadshirt
Uploading an Image using the Admin UI
11
Image upload
Uploaded images
Spreadshirt
Retrieving Images using the API
12
http://res.cloudinary.com/hiptees/image/upload
/test/red-shirt.png
http://res.cloudinary.com/hiptees/image/upload
/test/santa-claus.png
Spreadshirt
Fetching Images from a Remote Source
13
http://res.cloudinary.com/hiptees/image/fetch/
http://image.spreadshirtmedia.net
/image-server/v1/productTypes/813
/views/1/appearances/366
,width=1200,height=1200,mediaType=png
http://res.cloudinary.com/hiptees/image/fetch/
http://image.spreadshirtmedia.net
/image-server/v1/designs/12720381
,width=600,mediaType=png
Spreadshirt
Configuring Remote Image Folders
14
Configured remote
folder
Spreadshirt
Fetching Images Using a Remote Folder
15
http://res.cloudinary.com/hiptees/image/upload
/productTypes/813/views/1/appearances/366,
width=1200,height=1200,mediaType=png
http://res.cloudinary.com/hiptees/image/upload
/designs/12720381,width=600,mediaType=png
Spreadshirt
Behind the Scenes
16
Fetched image version stored
in Cloudinary file system for
later reuse
Spreadshirt
Cloudinary Image Transformation Functions
…
17
• Deliver optimized image with q_auto – 494 vs 167 kb
http://res.cloudinary.com/hiptees/image/upload
/q_auto/test/red-shirt.png
• Deliver optimized image format with f_auto – 167 vs 41
kb (webp)
http://res.cloudinary.com/hiptees/image/upload
/q_auto,f_auto/test/red-shirt.png
• Resize image with w_{width} –
http://res.cloudinary.com/hiptees/image/upload
/q_auto,f_auto,w_100/test/red-shirt.png
Spreadshirt
Cloudinary Image Transformation Functions
…
18
• Crop image with c_crop –
http://res.cloudinary.com/hiptees/image/upload
/q_auto,f_auto,c_crop,g_north_west,x_300,y_100,w_
600,h_600
/test/red-shirt.png
• Add watermark with overlay l_{image} –
http://res.cloudinary.com/hiptees/image/upload
/q_auto,f_auto,l_test:spreadshirt-
logo,w_200,g_center,o_10
/test/red-shirt.png
• … and a lot more features ...
Spreadshirt 19
Rendering Spreadshirt Product
Images with Cloudinary
Spreadshirt
Composing Images using Cloudinary’s
Transformation Functions
20
• Scale down to a default image size – c_scale,w_600
• Use Cloudinary’s overlay function to add image to another –
l_designs:12720381
• Position image using gravity, position and size -
g_north_west,x_200,y_100,w_200,c_scale
• Putting the things together
http://res.cloudinary.com/hiptees/image/upload
/c_scale,w_600
/l_designs:12720381,g_north_west,
x_200,y_200,w_200,c_scale
/v12345/productTypes/813/views/1/appearances
/366,width=1200,height=1200,mediaType=png
Spreadshirt
Design Position Calculation Recap
21
int defaultImageSize = 600;
String productId = "200636457";
String viewId = "1”;
Product product = loadSpreadshirtProduct(productId);
DesignConfiguration config = (DesignConfiguration)product.configurations.get(0);
ProductType productType = loadSpreadshirtProductType(product.productType.id);
View view = productType.getView(viewId);
ViewMap viewMap = view.getViewMap(config.printArea.id);
double viewScaleX = (double) defaultImageSize / view.size.width;
double viewScaleY = (double) defaultImageSize / view.size.height;
double viewMapX = viewMap.offset.x * viewScaleX;
double viewMapY = viewMap.offset.y * viewScaleY;
double designConfigurationOffsetX = config.offset.x * viewScaleX;
double designConfigurationOffsetY = config.offset.y * viewScaleY;
double designConfigurationWidth = config.content.svg.image.width * viewScaleX;
double designConfigurationHeight = config.content.svg.image.height * viewScaleY;
int x = (int) (viewMapX + designConfigurationOffsetX);
int y = (int) (viewMapY + designConfigurationOffsetY);
int width = (int) (designConfigurationWidth);
int height = (int) (designConfigurationHeight);
Spreadshirt
Scale Down and Image Optimization per
Browser
22
• Scale output image to desired size – c_scale,w_300
• Optimize image format and quality for delivery to browser –
q_auto,f_auto
• Putting the things together
http://res.cloudinary.com/hiptees/image/upload
/c_scale,w_600
/l_designs:12720381,g_north_west,
x_200,y_200,w_200,c_scale
/w_300,c_scale,q_auto,f_auto
/v12345/productTypes/813/views/1/appearances/
366,width=1200,height=1200,mediaType=png
Spreadshirt
Hiding the “Ugly” URLs
23
http://res.cloudinary.com/hiptees/image/upload
/c_scale,w_600
/l_designs:12720381,g_north_west,
x_200,y_200,w_200,c_scale
/w_300,c_scale,q_auto,f_auto
/v12345/productTypes/813/views/1/appearances/
366,width=1200,height=1200,mediaType=png
http://image.spreadshirtmedia.net
/products/medium/200636457/v1/women’s-
premium-t-shirt.jpg
Spreadshirt
Problems Solved
24
• http://image.spreadshirtmedia.net/products
/<sizes>/<productId>/<modifications>/<seo>.<ending>
 Sizes – Use predefined sizes small, medium, large so URLs
don’t break on size changes
 ProductId – Extra context for productId so we have all
modifications for one size on one context
 Modifications – Put view, appearance, … in one modification
string to reduce path length
 Seo – Add SEO part and redirect on SEO part changes
 Ending - Deliver optimized image formats per browser on the
same URL
 TTL - Use short TTL for browser caching, 365 day TTL for
AKAMAI and Edge-Content-Tag header and FastPurge to purge
images on changes
Spreadshirt
Cloudinary Image Service
25
Cloudinary
Image Server
Request
product image
Product
Data
Product
Type
Data
Design
Data
Product
Type View
Image
Design
Image
Load data
from API
Request
product image
Load images
from image server
Spreadshirt
Implementation Details
26
• https://github.com/mbreest/cloudinary-image-server
• Start it as follows
 mvn package && java -jar target/cloudinary-image-server-1.0-
SNAPSHOT.jar --spring.config.location=cloudinary.yaml
• Request image
 http://localhost:8080/products/medium/200636457/v1/women%E2
%80%99s-premium-t-shirt.jpg
 Request different size -
http://localhost:8080/products/small/200636457/v1/women%E2%8
0%99s-premium-t-shirt.jpg
 Request different appearance –
http://localhost:8080/products/small/200636457/v1a1/women%E2
%80%99s-premium-t-shirt.jpg
 Request with wrong SEO string –
http://localhost:8080/products/small/200636457/v1a1/seo-issue.jpg
Spreadshirt
More Cloudinary Documentation
27
• Cloudinary API documentation -
http://cloudinary.com/documentation
• Cloudinary blog - http://cloudinary.com/blog
Spreadshirt 28
Conclusion
Spreadshirt
Conclusion
29
• Cloudinary
 Provides nice admin UI for managing images
 Provides a powerful API for retrieving and transforming images
 Provides different integration options where one is fetching
source images from a remote source on-the-fly
 Runs on proven and scalable infrastructure like AWS and
AKAMAI
 Provides required features for creating image compositions
Spreadshirt
Conclusion
30
• PoC Cloudinary Image Server
 Encapsulates product image generation logic
 Solves problem of “ugly” Cloudinary URLs and a couple of
common SEO issues
 Can be deployed globally and close to Cloudinary data
centers on AWS cloud
 Thinking more radically, we can even upload our images to
Cloudinary directly and get rid of the whole S3/Ceph
problem
Spreadshirt 31
Q&A

More Related Content

Similar to PoC Rendering Spreadshirt Product Images Using Cloudinary

Optimize Images for SEO WordCamp Sacramento
Optimize Images for SEO WordCamp SacramentoOptimize Images for SEO WordCamp Sacramento
Optimize Images for SEO WordCamp SacramentoLeslie Staller
 
Artlinks Website Workshop P Mc Caul
Artlinks Website Workshop P Mc CaulArtlinks Website Workshop P Mc Caul
Artlinks Website Workshop P Mc CaulArtLinks
 
JS Fest 2019/Autumn. Sota Ohara. Сreate own server less CMS from scratch
JS Fest 2019/Autumn. Sota Ohara. Сreate own server less CMS from scratchJS Fest 2019/Autumn. Sota Ohara. Сreate own server less CMS from scratch
JS Fest 2019/Autumn. Sota Ohara. Сreate own server less CMS from scratchJSFestUA
 
Adobe MAX 2008: HTML/CSS + Fireworks
Adobe MAX 2008: HTML/CSS + FireworksAdobe MAX 2008: HTML/CSS + Fireworks
Adobe MAX 2008: HTML/CSS + FireworksNathan Smith
 
TERMINALFOUR t44u 2008 - Harry McKillen - Google & Flash Integration with Sit...
TERMINALFOUR t44u 2008 - Harry McKillen - Google & Flash Integration with Sit...TERMINALFOUR t44u 2008 - Harry McKillen - Google & Flash Integration with Sit...
TERMINALFOUR t44u 2008 - Harry McKillen - Google & Flash Integration with Sit...Terminalfour
 
Scaling digital asset repositories with aem dam and s7 by Devang Shah
Scaling digital asset repositories with aem dam and s7 by Devang ShahScaling digital asset repositories with aem dam and s7 by Devang Shah
Scaling digital asset repositories with aem dam and s7 by Devang ShahAEM HUB
 
Implementing Large Scale Digital Asset Repositories with Adobe Experience Man...
Implementing Large Scale Digital Asset Repositories with Adobe Experience Man...Implementing Large Scale Digital Asset Repositories with Adobe Experience Man...
Implementing Large Scale Digital Asset Repositories with Adobe Experience Man...devang-dsshah
 
AWS Summit London 2014 | Options for Hybrid Environments (200)
AWS Summit London 2014 | Options for Hybrid Environments (200)AWS Summit London 2014 | Options for Hybrid Environments (200)
AWS Summit London 2014 | Options for Hybrid Environments (200)Amazon Web Services
 
Wix's ML Platform
Wix's ML PlatformWix's ML Platform
Wix's ML PlatformRan Romano
 
James Jara Portfolio 2014 Part 1
James Jara Portfolio 2014 Part 1James Jara Portfolio 2014 Part 1
James Jara Portfolio 2014 Part 1James Jara
 
Stephan Spencer - SMX Advanced: Rich Snippets, Schema & Microformats
Stephan Spencer - SMX Advanced: Rich Snippets, Schema & MicroformatsStephan Spencer - SMX Advanced: Rich Snippets, Schema & Microformats
Stephan Spencer - SMX Advanced: Rich Snippets, Schema & MicroformatsSearch Marketing Expo - SMX
 
Advanced WordPress Optimization - iGaming Supershow 2012
Advanced WordPress Optimization - iGaming Supershow 2012Advanced WordPress Optimization - iGaming Supershow 2012
Advanced WordPress Optimization - iGaming Supershow 2012Bastian Grimm
 
Switching from Canvas to Storefront
Switching from Canvas to StorefrontSwitching from Canvas to Storefront
Switching from Canvas to StorefrontHerb Miller
 
Web site fundamentals
Web site fundamentalsWeb site fundamentals
Web site fundamentalsvinturella
 
Optimized Media Management in the Cloud: Automating Digital Media Workflows p...
Optimized Media Management in the Cloud: Automating Digital Media Workflows p...Optimized Media Management in the Cloud: Automating Digital Media Workflows p...
Optimized Media Management in the Cloud: Automating Digital Media Workflows p...Amazon Web Services
 
Image con keynote product
Image con keynote productImage con keynote product
Image con keynote productAlexa Phoenix
 

Similar to PoC Rendering Spreadshirt Product Images Using Cloudinary (20)

Optimize Images for SEO WordCamp Sacramento
Optimize Images for SEO WordCamp SacramentoOptimize Images for SEO WordCamp Sacramento
Optimize Images for SEO WordCamp Sacramento
 
Artlinks Website Workshop P Mc Caul
Artlinks Website Workshop P Mc CaulArtlinks Website Workshop P Mc Caul
Artlinks Website Workshop P Mc Caul
 
Online Marketing Audit Example
Online Marketing Audit ExampleOnline Marketing Audit Example
Online Marketing Audit Example
 
JS Fest 2019/Autumn. Sota Ohara. Сreate own server less CMS from scratch
JS Fest 2019/Autumn. Sota Ohara. Сreate own server less CMS from scratchJS Fest 2019/Autumn. Sota Ohara. Сreate own server less CMS from scratch
JS Fest 2019/Autumn. Sota Ohara. Сreate own server less CMS from scratch
 
Adobe MAX 2008: HTML/CSS + Fireworks
Adobe MAX 2008: HTML/CSS + FireworksAdobe MAX 2008: HTML/CSS + Fireworks
Adobe MAX 2008: HTML/CSS + Fireworks
 
TERMINALFOUR t44u 2008 - Harry McKillen - Google & Flash Integration with Sit...
TERMINALFOUR t44u 2008 - Harry McKillen - Google & Flash Integration with Sit...TERMINALFOUR t44u 2008 - Harry McKillen - Google & Flash Integration with Sit...
TERMINALFOUR t44u 2008 - Harry McKillen - Google & Flash Integration with Sit...
 
Scaling digital asset repositories with aem dam and s7 by Devang Shah
Scaling digital asset repositories with aem dam and s7 by Devang ShahScaling digital asset repositories with aem dam and s7 by Devang Shah
Scaling digital asset repositories with aem dam and s7 by Devang Shah
 
Implementing Large Scale Digital Asset Repositories with Adobe Experience Man...
Implementing Large Scale Digital Asset Repositories with Adobe Experience Man...Implementing Large Scale Digital Asset Repositories with Adobe Experience Man...
Implementing Large Scale Digital Asset Repositories with Adobe Experience Man...
 
CS-Cart Web To Print
CS-Cart Web To PrintCS-Cart Web To Print
CS-Cart Web To Print
 
AWS Summit London 2014 | Options for Hybrid Environments (200)
AWS Summit London 2014 | Options for Hybrid Environments (200)AWS Summit London 2014 | Options for Hybrid Environments (200)
AWS Summit London 2014 | Options for Hybrid Environments (200)
 
Wix's ML Platform
Wix's ML PlatformWix's ML Platform
Wix's ML Platform
 
Portafolio
PortafolioPortafolio
Portafolio
 
James Jara Portfolio 2014 Part 1
James Jara Portfolio 2014 Part 1James Jara Portfolio 2014 Part 1
James Jara Portfolio 2014 Part 1
 
Stephan Spencer - SMX Advanced: Rich Snippets, Schema & Microformats
Stephan Spencer - SMX Advanced: Rich Snippets, Schema & MicroformatsStephan Spencer - SMX Advanced: Rich Snippets, Schema & Microformats
Stephan Spencer - SMX Advanced: Rich Snippets, Schema & Microformats
 
Advanced WordPress Optimization - iGaming Supershow 2012
Advanced WordPress Optimization - iGaming Supershow 2012Advanced WordPress Optimization - iGaming Supershow 2012
Advanced WordPress Optimization - iGaming Supershow 2012
 
Seo
SeoSeo
Seo
 
Switching from Canvas to Storefront
Switching from Canvas to StorefrontSwitching from Canvas to Storefront
Switching from Canvas to Storefront
 
Web site fundamentals
Web site fundamentalsWeb site fundamentals
Web site fundamentals
 
Optimized Media Management in the Cloud: Automating Digital Media Workflows p...
Optimized Media Management in the Cloud: Automating Digital Media Workflows p...Optimized Media Management in the Cloud: Automating Digital Media Workflows p...
Optimized Media Management in the Cloud: Automating Digital Media Workflows p...
 
Image con keynote product
Image con keynote productImage con keynote product
Image con keynote product
 

Recently uploaded

APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 

Recently uploaded (20)

APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 

PoC Rendering Spreadshirt Product Images Using Cloudinary

  • 1. Spreadshirt PoC Rendering Spreadshirt Product Images with Cloudinary Martin Breest
  • 2. Spreadshirt Agenda 2 • Spreadshirt product image generation explained • Cloudinary explained • Rendering Spreadshirt product images with Cloudinary
  • 3. Spreadshirt 3 Spreadshirt Product Image Generation Explained
  • 4. Spreadshirt Product Image Explained 4 Product image: http://image.spreadshirtmedia.net/image-server/v1/products/200636457/views/1,width=100.png Product image ProductType image Design image consists of
  • 5. Spreadshirt Product Image Rendering Explained 5 Image Server Request product image Product Data Product Type Data Design Data Product Type View Image Design Image Loads data from API and file system Product data: http://www.spreadshirt.de/api/v1/shops/205909/products/200636457 ProductType data: http://www.spreadshirt.de/api/v1/shops/205909/productTypes/813 Design data: http://www.spreadshirt.de/api/v1/shops/205909/designs/m12720381-2 ProductType View image: http://image.spreadshirtmedia.net/image-server/v1/productTypes/813/views/1/appearances/366 Design image: http://image.spreadshirtmedia.net/image-server/v1/designs/12720381
  • 6. Spreadshirt Design Positioning on Product Image 6 View width and height from ProductType PrintArea offset x and y from ProductType Design offset x and y from Product’s DesignConfiguration Design width and height from Product’s DesignConfiguration
  • 7. Spreadshirt Design Position Calculation 7 int defaultImageSize = 600; String productId = "200636457"; String viewId = "1”; Product product = loadSpreadshirtProduct(productId); DesignConfiguration config = (DesignConfiguration)product.configurations.get(0); ProductType productType = loadSpreadshirtProductType(product.productType.id); View view = productType.getView(viewId); ViewMap viewMap = view.getViewMap(config.printArea.id); double viewScaleX = (double) defaultImageSize / view.size.width; double viewScaleY = (double) defaultImageSize / view.size.height; double viewMapX = viewMap.offset.x * viewScaleX; double viewMapY = viewMap.offset.y * viewScaleY; double designConfigurationOffsetX = config.offset.x * viewScaleX; double designConfigurationOffsetY = config.offset.y * viewScaleY; double designConfigurationWidth = config.content.svg.image.width * viewScaleX; double designConfigurationHeight = config.content.svg.image.height * viewScaleY; int x = (int) (viewMapX + designConfigurationOffsetX); int y = (int) (viewMapY + designConfigurationOffsetY); int width = (int) (designConfigurationWidth); int height = (int) (designConfigurationHeight);
  • 9. Spreadshirt Cloudinary Features 9 Powerful image retrieval and manipulation API Nice image management admin UI Various integrations for fetching source images
  • 10. Spreadshirt Cloudinary Infrastructure 10 Processes data on AWS EC2 Stores data on AWS S3 Caches data on AKAMAI CDN
  • 11. Spreadshirt Uploading an Image using the Admin UI 11 Image upload Uploaded images
  • 12. Spreadshirt Retrieving Images using the API 12 http://res.cloudinary.com/hiptees/image/upload /test/red-shirt.png http://res.cloudinary.com/hiptees/image/upload /test/santa-claus.png
  • 13. Spreadshirt Fetching Images from a Remote Source 13 http://res.cloudinary.com/hiptees/image/fetch/ http://image.spreadshirtmedia.net /image-server/v1/productTypes/813 /views/1/appearances/366 ,width=1200,height=1200,mediaType=png http://res.cloudinary.com/hiptees/image/fetch/ http://image.spreadshirtmedia.net /image-server/v1/designs/12720381 ,width=600,mediaType=png
  • 14. Spreadshirt Configuring Remote Image Folders 14 Configured remote folder
  • 15. Spreadshirt Fetching Images Using a Remote Folder 15 http://res.cloudinary.com/hiptees/image/upload /productTypes/813/views/1/appearances/366, width=1200,height=1200,mediaType=png http://res.cloudinary.com/hiptees/image/upload /designs/12720381,width=600,mediaType=png
  • 16. Spreadshirt Behind the Scenes 16 Fetched image version stored in Cloudinary file system for later reuse
  • 17. Spreadshirt Cloudinary Image Transformation Functions … 17 • Deliver optimized image with q_auto – 494 vs 167 kb http://res.cloudinary.com/hiptees/image/upload /q_auto/test/red-shirt.png • Deliver optimized image format with f_auto – 167 vs 41 kb (webp) http://res.cloudinary.com/hiptees/image/upload /q_auto,f_auto/test/red-shirt.png • Resize image with w_{width} – http://res.cloudinary.com/hiptees/image/upload /q_auto,f_auto,w_100/test/red-shirt.png
  • 18. Spreadshirt Cloudinary Image Transformation Functions … 18 • Crop image with c_crop – http://res.cloudinary.com/hiptees/image/upload /q_auto,f_auto,c_crop,g_north_west,x_300,y_100,w_ 600,h_600 /test/red-shirt.png • Add watermark with overlay l_{image} – http://res.cloudinary.com/hiptees/image/upload /q_auto,f_auto,l_test:spreadshirt- logo,w_200,g_center,o_10 /test/red-shirt.png • … and a lot more features ...
  • 19. Spreadshirt 19 Rendering Spreadshirt Product Images with Cloudinary
  • 20. Spreadshirt Composing Images using Cloudinary’s Transformation Functions 20 • Scale down to a default image size – c_scale,w_600 • Use Cloudinary’s overlay function to add image to another – l_designs:12720381 • Position image using gravity, position and size - g_north_west,x_200,y_100,w_200,c_scale • Putting the things together http://res.cloudinary.com/hiptees/image/upload /c_scale,w_600 /l_designs:12720381,g_north_west, x_200,y_200,w_200,c_scale /v12345/productTypes/813/views/1/appearances /366,width=1200,height=1200,mediaType=png
  • 21. Spreadshirt Design Position Calculation Recap 21 int defaultImageSize = 600; String productId = "200636457"; String viewId = "1”; Product product = loadSpreadshirtProduct(productId); DesignConfiguration config = (DesignConfiguration)product.configurations.get(0); ProductType productType = loadSpreadshirtProductType(product.productType.id); View view = productType.getView(viewId); ViewMap viewMap = view.getViewMap(config.printArea.id); double viewScaleX = (double) defaultImageSize / view.size.width; double viewScaleY = (double) defaultImageSize / view.size.height; double viewMapX = viewMap.offset.x * viewScaleX; double viewMapY = viewMap.offset.y * viewScaleY; double designConfigurationOffsetX = config.offset.x * viewScaleX; double designConfigurationOffsetY = config.offset.y * viewScaleY; double designConfigurationWidth = config.content.svg.image.width * viewScaleX; double designConfigurationHeight = config.content.svg.image.height * viewScaleY; int x = (int) (viewMapX + designConfigurationOffsetX); int y = (int) (viewMapY + designConfigurationOffsetY); int width = (int) (designConfigurationWidth); int height = (int) (designConfigurationHeight);
  • 22. Spreadshirt Scale Down and Image Optimization per Browser 22 • Scale output image to desired size – c_scale,w_300 • Optimize image format and quality for delivery to browser – q_auto,f_auto • Putting the things together http://res.cloudinary.com/hiptees/image/upload /c_scale,w_600 /l_designs:12720381,g_north_west, x_200,y_200,w_200,c_scale /w_300,c_scale,q_auto,f_auto /v12345/productTypes/813/views/1/appearances/ 366,width=1200,height=1200,mediaType=png
  • 23. Spreadshirt Hiding the “Ugly” URLs 23 http://res.cloudinary.com/hiptees/image/upload /c_scale,w_600 /l_designs:12720381,g_north_west, x_200,y_200,w_200,c_scale /w_300,c_scale,q_auto,f_auto /v12345/productTypes/813/views/1/appearances/ 366,width=1200,height=1200,mediaType=png http://image.spreadshirtmedia.net /products/medium/200636457/v1/women’s- premium-t-shirt.jpg
  • 24. Spreadshirt Problems Solved 24 • http://image.spreadshirtmedia.net/products /<sizes>/<productId>/<modifications>/<seo>.<ending>  Sizes – Use predefined sizes small, medium, large so URLs don’t break on size changes  ProductId – Extra context for productId so we have all modifications for one size on one context  Modifications – Put view, appearance, … in one modification string to reduce path length  Seo – Add SEO part and redirect on SEO part changes  Ending - Deliver optimized image formats per browser on the same URL  TTL - Use short TTL for browser caching, 365 day TTL for AKAMAI and Edge-Content-Tag header and FastPurge to purge images on changes
  • 25. Spreadshirt Cloudinary Image Service 25 Cloudinary Image Server Request product image Product Data Product Type Data Design Data Product Type View Image Design Image Load data from API Request product image Load images from image server
  • 26. Spreadshirt Implementation Details 26 • https://github.com/mbreest/cloudinary-image-server • Start it as follows  mvn package && java -jar target/cloudinary-image-server-1.0- SNAPSHOT.jar --spring.config.location=cloudinary.yaml • Request image  http://localhost:8080/products/medium/200636457/v1/women%E2 %80%99s-premium-t-shirt.jpg  Request different size - http://localhost:8080/products/small/200636457/v1/women%E2%8 0%99s-premium-t-shirt.jpg  Request different appearance – http://localhost:8080/products/small/200636457/v1a1/women%E2 %80%99s-premium-t-shirt.jpg  Request with wrong SEO string – http://localhost:8080/products/small/200636457/v1a1/seo-issue.jpg
  • 27. Spreadshirt More Cloudinary Documentation 27 • Cloudinary API documentation - http://cloudinary.com/documentation • Cloudinary blog - http://cloudinary.com/blog
  • 29. Spreadshirt Conclusion 29 • Cloudinary  Provides nice admin UI for managing images  Provides a powerful API for retrieving and transforming images  Provides different integration options where one is fetching source images from a remote source on-the-fly  Runs on proven and scalable infrastructure like AWS and AKAMAI  Provides required features for creating image compositions
  • 30. Spreadshirt Conclusion 30 • PoC Cloudinary Image Server  Encapsulates product image generation logic  Solves problem of “ugly” Cloudinary URLs and a couple of common SEO issues  Can be deployed globally and close to Cloudinary data centers on AWS cloud  Thinking more radically, we can even upload our images to Cloudinary directly and get rid of the whole S3/Ceph problem

Editor's Notes

  1. Product image consists of configurations applying text or designs to a product type In most cases we just add one design to a product type
  2. Use Cloudinary for images managed by content team already Cloudinary provides scalable image management solution in the cloud Cloudinary provides nice UI to manage images (and other media files) Cloudinary provides powerful API to retrieve and modify images Cloudinary allows to dynamically fetch images from a remote origin Cloudinary delivers optimized image per browser