{"id":21132,"date":"2012-05-15T07:26:10","date_gmt":"2012-05-15T07:26:10","guid":{"rendered":"http:\/\/how_to_deliver_your_static_images_through_a_cdn_in_ruby_on_rails"},"modified":"2025-03-30T13:00:54","modified_gmt":"2025-03-30T20:00:54","slug":"how_to_deliver_your_static_images_through_a_cdn_in_ruby_on_rails","status":"publish","type":"post","link":"https:\/\/cloudinary.com\/blog\/how_to_deliver_your_static_images_through_a_cdn_in_ruby_on_rails","title":{"rendered":"Use Ruby on Rails to Deliver Static Images Via CDN"},"content":{"rendered":"<div>If you heard of Cloudinary before, you probably already know how useful Cloudinary is with managing all your dynamically uploaded images, transforming these to their required dimensions, performing <a href=\"https:\/\/cloudinary.com\/documentation\/image_optimization\" target=\"_blank\" rel=\"noopener\">image optimization<\/a> to ensure files are have the optimal quality and parameters, and delivering them through a fast CDN.<\/div>\n<div>But what about all the static images you have in your web application? background images, buttons, icons &#8211; they too should be delivered through a Rails CDN, offloading their delivery from your servers and improvixng your website&#8217;s performance.<\/div>\n<div>You can always do it yourself &#8211; setup your cloud environment, upload all these static images to your cloud storage, access them through a Rails CDN and make sure to update these images when they change.<\/div>\n<div>Or &#8211; you can let Cloudinary do it. Automatically.<\/div>\n<div>In this post we wanted to introduce a new Cloudinary feature. This feature simplifies and streamlines the process of uploading your static images to the cloud and delivering them through a Rails CDN.<\/div>\n<div>If you haven&#8217;t done so already &#8211; upgrade to our latest <a href=\"https:\/\/github.com\/cloudinary\/cloudinary_gem\" target=\"_blank\" rel=\"noopener\">Ruby GEM<\/a> and you will enjoy this new feature with zero code change.<\/div>\n<div>How is this done? First, upload all your Ruby-on-Rails applications&#8217; static images to Cloudinary, using a single Rake command:<\/div>\n<pre>rake cloudinary:sync_static\n \nimages\/logo.png - logo-5740ed843b23d0b86e48081f43a45b9c - Uploading\nimages\/icon_rails.png - icon_rails-74dca949999d8f5960aedfed429711ab - Uploading\nimages\/spinner.gif - spinner-3a0ae382485ddcfc5b57e638baa6005f - Uploading\nimages\/background.png - background-339f8567f25075150cca85d711e94b0c - Uploading\n \nCompleted syncing static resources to Cloudinary\n4 Uploaded\n<\/pre>\n<div>\n<div>This Rake task finds all the images in all common public folders and in Rails <strong>Asset Pipeline<\/strong>\u2019s image asset folders. Afterwards, it uploads all new and modified images to Cloudinary. Uploaded images and their versions are maintained using a local <strong>.cloudinary.static<\/strong> file. Make sure you commit this file to your source control.<\/div>\n<div>Now that you\u2019ve uploaded all your static images to Cloudinary, all you\u2019ve left to do in order to deliver these through a CDN is to edit your cloudinary.yml file and set the following configuration parameters to \u2018true\u2019:<\/div>\n<\/div>\n<pre>enhance_image_tag: true\nstatic_image_support: true\n<\/pre>\n<div>That&#8217;s it. No other code changes required. From now on, every image_tag call in your views would automatically check if the image was uploaded to the cloud (using .cloudinary.static) and if so, would generate a remote Cloudinary CDN URL.<\/div>\n<div>For example:<\/div>\n<pre>&lt;%= image_tag(\u201clogo.png\u201d, :width =&gt; 100, :height =&gt; 100) %&gt;\n<\/pre>\n<div>May generate the following HTML code:<\/div>\n<pre>&lt;img src=\"https:\/\/res.cloudinary.com\/demo\/image\/asset\/\n      logo-5740ed843b23d0b86e48081f43a45b9c\" width=\"100\" height=\"100\"\/&gt;\n<\/pre>\n<div>Keep in mind that you can activate CDN static image support in your production environment while keeping to local files in your development environment.<\/div>\n<div>When you add new static images or change existing ones, all you need to do is re-run \u2018rake cloudinary:sync_static\u2019.<\/div>\n<pre>rake cloudinary:sync_static\n \nimages\/logo.png - logo-5740ed843b23d0b86e48081f43a45b9c - Not changed\nimages\/icon_rails.png - icon-74dca949999d8f5960aedfed429711ab - Not changed\nimages\/spinner.gif - spinner-3a0ae382485ddcfc5b57e638baa6005f - Not changed\nimages\/background.png - background-339f8567f25075150cca85d711e94b0c - Not changed\nimages\/new_icon.gif - new_icon-50f7c240f43256e3f2bfaa3519dab1e8 - Uploading\n \nCompleted syncing static resources to Cloudinary\n4 Not changed, 1 Uploaded\n<\/pre>\n<div>If your website has many static images, you can optimize your site\u2019s load time further by using multiple CDN subdomains. See <a href=\"https:\/\/cloudinary.com\/blog\/introducing_multi_cdn_media_delivery_solutions_for_optimal_per_user_experience\">this blog post<\/a> for more details on how to activate this feature.<\/div>\n<div>\n<h3>CSS &amp; Sass<\/h3>\n<div style=\"padding-left: 30px;\"><strong style=\"color: #0c163b; font-family: Inter, sans-serif; font-size: 16px;\">UPDATE [November 2021]<\/strong><span style=\"color: #0c163b; font-family: Inter, sans-serif; font-size: 16px;\">:\u00a0<\/span><span style=\"font-family: 'Helvetica Neue'; font-size: medium;\">Ruby Sass was deprecated in 2019. The consensus is to use\u00a0SassC\u00a0instead. Note that<\/span><span style=\"font-size: medium;\"><span style=\"font-family: 'Helvetica Neue';\">\u00a0<\/span><span style=\"font-family: 'Helvetica Neue';\">as opposed to Sass, optional named arguments are not supported in SassC, use a hash map instead.<\/span><\/span><\/div>\n<p class=\"p1\" style=\"font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; margin: 0px; padding-left: 30px;\"><span style=\"font-size: medium;\">For example:<\/span><br \/>\n<span style=\"font-size: medium;\">Sass:\u00a0<span style=\"font-family: 'courier new', courier;\">cloudinary-url(&#8220;sample&#8221;, $quality: &#8220;auto&#8221;, $fetch_format: &#8220;auto&#8221;);<\/span><\/span><\/p>\n<p class=\"p1\" style=\"font-size: 13px; line-height: normal; font-family: 'Helvetica Neue'; margin: 0px; padding-left: 60px;\"><span style=\"font-size: medium;\">becomes:<\/span><\/p>\n<div style=\"padding-left: 30px;\"><span style=\"font-size: medium; font-family: 'Helvetica Neue';\">SassC:<\/span><span style=\"font-size: medium; font-family: 'Helvetica Neue';\">\u00a0<\/span><span style=\"font-family: 'courier new', courier;\">cloudinary-url(&#8220;sample&#8221;, (&#8220;quality&#8221;: &#8220;auto&#8221;, &#8220;fetch_format&#8221;: &#8220;auto&#8221;));<\/span><\/div>\n<div>The method described above is a powerful way for uploading all static images embedded in your Rails view to the cloud and delivering them through a CDN with no change to your code.<\/div>\n<div>But what about images defined in your <strong>CSS<\/strong> or <strong><a href=\"http:\/\/sass-lang.com\/\" target=\"_blank\" rel=\"noopener\">Sass<\/a><\/strong>\u00a0files?<\/div>\n<div>If you use the new Asset Pipeline (Rails 3.1+), this would work out-of-the-box. All <strong>image-path<\/strong> and <strong>image-url<\/strong> in your Sass files would automatically change to remote Cloudinary CDN URLs. For example:<\/div>\n<div><span style=\"color: #888888;\">Sass:<\/span><\/div>\n<pre>  .logo\n    background-image: image-url(\"logo.png\")\n\n<\/pre>\n<div><span style=\"color: #888888;\">Generated CSS:<\/span><\/div>\n<pre> \n.logo { background-image: url(https:\/\/res.cloudinary.com\/demo\/image\/asset\/logo-5740ed843b23d0b86e48081f43a45b9c) }\n<\/pre>\n<div>So if you already use Asset Pipeline and Sass files, your images will automatically be delivered through a CDN.<\/div>\n<h3>Transforming static images<\/h3>\n<div>One of Cloudinary&#8217;s major strengths is in its powerful image transformations. In most cases, you&#8217;ll want your static images displayed as-is. But occasionally, applying transformations on your static images can be very useful. For example, displaying a set of icons in multiple dimensions. Another example is when you want to support <a href=\"https:\/\/cloudinary.com\/documentation\/responsive_images\" target=\"_blank\" rel=\"noopener\">Responsive Layout and Images<\/a>. In this case, adjusting the size of all static images according to your visitors&#8217; device resolution might greatly improve your visitors&#8217; experience (e.g., resize all images to 50% their original size).<\/div>\n<div>With Cloudinary you can apply various transformations on your static images, with ease.<\/div>\n<div>In the following example, we take a 100&#215;100 static logo.png image and resize it on-the-fly to a 50&#215;50 image with rounded corners of 10 pixels radius. The following image_tag:<\/div>\n<pre>&lt;%= image_tag(\"icon_rails.png\", :width =&gt; 50, :height =&gt; 50,\n              :crop =&gt; :scale, :radius =&gt; 10) %&gt;\n<\/pre>\n<div><img loading=\"lazy\" decoding=\"async\" style=\"margin-left: auto; margin-right: auto;\" src=\"https:\/\/res.cloudinary.com\/cloudinary\/image\/asset\/c_scale,h_50,r_10,w_50\/icon_rails-74dca949999d8f5960aedfed429711ab.png\" alt=\"\" width=\"50\" height=\"50\" \/><\/div>\n<div>Will generate the following URL:<\/div>\n<pre>&lt;img width=\"50\" height=\"50\"\n  src=\"https:\/\/res.cloudinary.com\/cloudinary\/image\/asset\/\n  c_scale,h_50,r_10,w_50\/icon_rails-74dca949999d8f5960aedfed429711ab.png\"\/&gt;\n\n<\/pre>\n<div><\/div>\n<div>Cloudinary offers many more automatic image transformations including <a href=\"https:\/\/cloudinary.com\/documentation\/image_transformations#image_and_text_overlays\" target=\"_blank\" rel=\"noopener\">image and text overlays<\/a>, <a href=\"https:\/\/cloudinary.com\/documentation\/image_transformations#face_detection_based_transformations\" target=\"_blank\" rel=\"noopener\">face-detection<\/a> based cropping and resizing, <a href=\"https:\/\/cloudinary.com\/documentation\/image_transformations#image_format_support\" target=\"_blank\" rel=\"noopener\">image format conversion<\/a>, and even smart categorization, moderation and tagging of images via our <a href=\"https:\/\/cloudinary.com\/addons\" target=\"_blank\" rel=\"noopener\">partner add ons<\/a>. All of these can be accessed via the Rails SDK.<\/div>\n<div>Changing the look &amp; feel and dimensions of images in your site based on the user\u2019s device can be done using CSS instead of changing your code. This can be be made even simpler if you are using Sass in your Rails project. Simply use the &#8216;<strong>cloudinary-url<\/strong>&#8216; template method. It will convert image references to remote Cloudinary CDN URLs and can also receive all <a href=\"https:\/\/cloudinary.com\/documentation\/image_transformations\">supported transformation parameters<\/a>.<\/div>\n<div><\/div>\n<div>For example, the following Sass line would generate the same 50&#215;50 scaled logo with rounded corners, via Sass:<\/div>\n<pre>background-image: cloudinary-url(\"rails.png\", $width: 50, $height: 50,\n                                 $crop: \"scale\", $radius: 10);\n<\/pre>\n<div>To summarize &#8211; if you are using Cloudinary for managing and transforming your uploaded images, you should definitely follow the simple instructions above to immediately experience the performance boost gained by delivering all your static assets through Cloudinary. Don\u2019t have a Cloudinary account yet? <a href=\"https:\/\/cloudinary.com\/users\/register\/free\" target=\"_blank\" rel=\"noopener\">Click here<\/a>\u00a0to setup a free account in seconds.<\/div>\n<\/div>\n<p><!-- 3QK9UU8ZA2CK --><\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you heard of Cloudinary before, you probably already know how useful Cloudinary is with managing all your dynamically uploaded images, transforming these to their required dimensions, performing image optimization to ensure files are have the optimal quality and parameters, and delivering them through a fast CDN. But what about all the static images you [&hellip;]<\/p>\n","protected":false},"author":41,"featured_media":23369,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_cloudinary_featured_overwrite":false,"footnotes":""},"categories":[1],"tags":[227,257],"class_list":["post-21132","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-performance-optimization","tag-ruby-on-rails"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.6 (Yoast SEO v26.9) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Use Ruby on Rails to Deliver Static Images Via CDN<\/title>\n<meta name=\"description\" content=\"Learn how to transform and deliver static web assets with Rails CDN. Boost delivery performance and simplify image transformation with Cloudinary.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/cloudinary.com\/blog\/how_to_deliver_your_static_images_through_a_cdn_in_ruby_on_rails\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Use Ruby on Rails to Deliver Static Images Via CDN\" \/>\n<meta property=\"og:description\" content=\"Learn how to transform and deliver static web assets with Rails CDN. Boost delivery performance and simplify image transformation with Cloudinary.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/cloudinary.com\/blog\/how_to_deliver_your_static_images_through_a_cdn_in_ruby_on_rails\" \/>\n<meta property=\"og:site_name\" content=\"Cloudinary Blog\" \/>\n<meta property=\"article:published_time\" content=\"2012-05-15T07:26:10+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-03-30T20:00:54+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/v1647045702\/42_ruby_CDN\/42_ruby_CDN-jpg?_i=AA\" \/>\n\t<meta property=\"og:image:width\" content=\"2000\" \/>\n\t<meta property=\"og:image:height\" content=\"1100\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"NewsArticle\",\"@id\":\"https:\/\/cloudinary.com\/blog\/how_to_deliver_your_static_images_through_a_cdn_in_ruby_on_rails#article\",\"isPartOf\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/how_to_deliver_your_static_images_through_a_cdn_in_ruby_on_rails\"},\"author\":{\"name\":\"\",\"@id\":\"\"},\"headline\":\"Use Ruby on Rails to Deliver Static Images Via CDN\",\"datePublished\":\"2012-05-15T07:26:10+00:00\",\"dateModified\":\"2025-03-30T20:00:54+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/how_to_deliver_your_static_images_through_a_cdn_in_ruby_on_rails\"},\"wordCount\":915,\"publisher\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/how_to_deliver_your_static_images_through_a_cdn_in_ruby_on_rails#primaryimage\"},\"thumbnailUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1647045702\/42_ruby_CDN\/42_ruby_CDN.jpg?_i=AA\",\"keywords\":[\"Performance Optimization\",\"Ruby on Rails\"],\"inLanguage\":\"en-US\",\"copyrightYear\":\"2012\",\"copyrightHolder\":{\"@id\":\"https:\/\/cloudinary.com\/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/cloudinary.com\/blog\/how_to_deliver_your_static_images_through_a_cdn_in_ruby_on_rails\",\"url\":\"https:\/\/cloudinary.com\/blog\/how_to_deliver_your_static_images_through_a_cdn_in_ruby_on_rails\",\"name\":\"Use Ruby on Rails to Deliver Static Images Via CDN\",\"isPartOf\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/how_to_deliver_your_static_images_through_a_cdn_in_ruby_on_rails#primaryimage\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/how_to_deliver_your_static_images_through_a_cdn_in_ruby_on_rails#primaryimage\"},\"thumbnailUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1647045702\/42_ruby_CDN\/42_ruby_CDN.jpg?_i=AA\",\"datePublished\":\"2012-05-15T07:26:10+00:00\",\"dateModified\":\"2025-03-30T20:00:54+00:00\",\"description\":\"Learn how to transform and deliver static web assets with Rails CDN. Boost delivery performance and simplify image transformation with Cloudinary.\",\"breadcrumb\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/how_to_deliver_your_static_images_through_a_cdn_in_ruby_on_rails#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/cloudinary.com\/blog\/how_to_deliver_your_static_images_through_a_cdn_in_ruby_on_rails\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cloudinary.com\/blog\/how_to_deliver_your_static_images_through_a_cdn_in_ruby_on_rails#primaryimage\",\"url\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1647045702\/42_ruby_CDN\/42_ruby_CDN.jpg?_i=AA\",\"contentUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1647045702\/42_ruby_CDN\/42_ruby_CDN.jpg?_i=AA\",\"width\":2000,\"height\":1100},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/cloudinary.com\/blog\/how_to_deliver_your_static_images_through_a_cdn_in_ruby_on_rails#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/cloudinary.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Use Ruby on Rails to Deliver Static Images Via CDN\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#website\",\"url\":\"https:\/\/cloudinary.com\/blog\/\",\"name\":\"Cloudinary Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/cloudinary.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#organization\",\"name\":\"Cloudinary Blog\",\"url\":\"https:\/\/cloudinary.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA\",\"contentUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA\",\"width\":312,\"height\":60,\"caption\":\"Cloudinary Blog\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Use Ruby on Rails to Deliver Static Images Via CDN","description":"Learn how to transform and deliver static web assets with Rails CDN. Boost delivery performance and simplify image transformation with Cloudinary.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/cloudinary.com\/blog\/how_to_deliver_your_static_images_through_a_cdn_in_ruby_on_rails","og_locale":"en_US","og_type":"article","og_title":"Use Ruby on Rails to Deliver Static Images Via CDN","og_description":"Learn how to transform and deliver static web assets with Rails CDN. Boost delivery performance and simplify image transformation with Cloudinary.","og_url":"https:\/\/cloudinary.com\/blog\/how_to_deliver_your_static_images_through_a_cdn_in_ruby_on_rails","og_site_name":"Cloudinary Blog","article_published_time":"2012-05-15T07:26:10+00:00","article_modified_time":"2025-03-30T20:00:54+00:00","og_image":[{"width":2000,"height":1100,"url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/v1647045702\/42_ruby_CDN\/42_ruby_CDN-jpg?_i=AA","type":"image\/jpeg"}],"twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"NewsArticle","@id":"https:\/\/cloudinary.com\/blog\/how_to_deliver_your_static_images_through_a_cdn_in_ruby_on_rails#article","isPartOf":{"@id":"https:\/\/cloudinary.com\/blog\/how_to_deliver_your_static_images_through_a_cdn_in_ruby_on_rails"},"author":{"name":"","@id":""},"headline":"Use Ruby on Rails to Deliver Static Images Via CDN","datePublished":"2012-05-15T07:26:10+00:00","dateModified":"2025-03-30T20:00:54+00:00","mainEntityOfPage":{"@id":"https:\/\/cloudinary.com\/blog\/how_to_deliver_your_static_images_through_a_cdn_in_ruby_on_rails"},"wordCount":915,"publisher":{"@id":"https:\/\/cloudinary.com\/blog\/#organization"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/how_to_deliver_your_static_images_through_a_cdn_in_ruby_on_rails#primaryimage"},"thumbnailUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1647045702\/42_ruby_CDN\/42_ruby_CDN.jpg?_i=AA","keywords":["Performance Optimization","Ruby on Rails"],"inLanguage":"en-US","copyrightYear":"2012","copyrightHolder":{"@id":"https:\/\/cloudinary.com\/#organization"}},{"@type":"WebPage","@id":"https:\/\/cloudinary.com\/blog\/how_to_deliver_your_static_images_through_a_cdn_in_ruby_on_rails","url":"https:\/\/cloudinary.com\/blog\/how_to_deliver_your_static_images_through_a_cdn_in_ruby_on_rails","name":"Use Ruby on Rails to Deliver Static Images Via CDN","isPartOf":{"@id":"https:\/\/cloudinary.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/cloudinary.com\/blog\/how_to_deliver_your_static_images_through_a_cdn_in_ruby_on_rails#primaryimage"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/how_to_deliver_your_static_images_through_a_cdn_in_ruby_on_rails#primaryimage"},"thumbnailUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1647045702\/42_ruby_CDN\/42_ruby_CDN.jpg?_i=AA","datePublished":"2012-05-15T07:26:10+00:00","dateModified":"2025-03-30T20:00:54+00:00","description":"Learn how to transform and deliver static web assets with Rails CDN. Boost delivery performance and simplify image transformation with Cloudinary.","breadcrumb":{"@id":"https:\/\/cloudinary.com\/blog\/how_to_deliver_your_static_images_through_a_cdn_in_ruby_on_rails#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/cloudinary.com\/blog\/how_to_deliver_your_static_images_through_a_cdn_in_ruby_on_rails"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudinary.com\/blog\/how_to_deliver_your_static_images_through_a_cdn_in_ruby_on_rails#primaryimage","url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1647045702\/42_ruby_CDN\/42_ruby_CDN.jpg?_i=AA","contentUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1647045702\/42_ruby_CDN\/42_ruby_CDN.jpg?_i=AA","width":2000,"height":1100},{"@type":"BreadcrumbList","@id":"https:\/\/cloudinary.com\/blog\/how_to_deliver_your_static_images_through_a_cdn_in_ruby_on_rails#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/cloudinary.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Use Ruby on Rails to Deliver Static Images Via CDN"}]},{"@type":"WebSite","@id":"https:\/\/cloudinary.com\/blog\/#website","url":"https:\/\/cloudinary.com\/blog\/","name":"Cloudinary Blog","description":"","publisher":{"@id":"https:\/\/cloudinary.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/cloudinary.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/cloudinary.com\/blog\/#organization","name":"Cloudinary Blog","url":"https:\/\/cloudinary.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA","contentUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA","width":312,"height":60,"caption":"Cloudinary Blog"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":""}]}},"jetpack_featured_media_url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1647045702\/42_ruby_CDN\/42_ruby_CDN.jpg?_i=AA","_links":{"self":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/21132","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/users\/41"}],"replies":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/comments?post=21132"}],"version-history":[{"count":3,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/21132\/revisions"}],"predecessor-version":[{"id":37322,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/21132\/revisions\/37322"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/media\/23369"}],"wp:attachment":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/media?parent=21132"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/categories?post=21132"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/tags?post=21132"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}