{"id":21360,"date":"2016-03-10T13:24:04","date_gmt":"2016-03-10T13:24:04","guid":{"rendered":"http:\/\/painless_image_and_video_manipulation_with_javascript"},"modified":"2024-06-01T10:28:07","modified_gmt":"2024-06-01T17:28:07","slug":"painless_image_and_video_manipulation_with_javascript","status":"publish","type":"post","link":"https:\/\/cloudinary.com\/blog\/painless_image_and_video_manipulation_with_javascript","title":{"rendered":"Automated JavaScript Image Transformation and Management"},"content":{"rendered":"<div class=\"wp-block-cloudinary-markdown \"><h3>TL;DR<\/h3>\n<p>Cloudinary\u2019s JavaScript library accelerates web development by providing automated JavaScript image transformation and management with a few lines of code. The newly released version streamlines the library by providing a much requested jQuery-free core library. At the same time it is fully backward compatible with previous versions. The new library is further enhanced with classes and a chainable API, making the implementation of Cloudinary functionality in your application easier (and more enjoyable!).<\/p>\n<h3>Overview<\/h3>\n<p>Virtually all websites incorporate images and videos in their web pages. With the proliferation of web platforms, devices and rising user expectations, handling media is an increasingly complex task. Services such as Cloudinary alleviate the pain by relieving the developer from having to manually transform images, respond to device and layout constraints, and manage storage and availability concerns.<\/p>\n<p>A typical mistake made by novice developers is to provide full size images on the web page. This guaranties that the page will look great on the highest resolution, but at a large cost to download and response times &#8211; not to mention bandwidth costs.<\/p>\n<p>The easiest solution &#8211; using JavaScript image transformation software to create a smaller resolution version of each image &#8211; is quickly revealed to be an exponentially difficult task. For one thing, you have to code your web page to display the right image file. Furthermore, you have to keep track of all files related to the same source image. And any change in layout may require rescaling and re-cropping.<\/p>\n<p>Rinse and repeat for each and every image.<\/p>\n<p><a href=\"https:\/\/github.com\/cloudinary\/cloudinary_js\">Cloudinary\u2019s JavaScript library <\/a>essentially eliminates this nightmare.<\/p>\n<p>Cloudinary\u2019s strength is largely due to its ability to transform images using a simply coded URL. For example, adding <code>c_scale,w_500<\/code> to the URL will scale the image to a width of &#8211; you guessed it &#8211; 500 pixels. The image is automatically scaled and cached on a CDN, ready to be served.<\/p>\n<p>Cloudinary\u2019s <a href=\"https:\/\/github.com\/cloudinary\/cloudinary_js\">JavaScript API <\/a>\u00a0provides the functionality required to programmatically declare the required transformations and generate Cloudinary resource URLs. For example, the aforementioned transformation can be expressed using the following configuration object: <code>{crop: \u201cscale\u201d, width: 500}<\/code>.<\/p>\n<p>Creating the imageURL (which will also generate a new image) is simple and intuitive:<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css shcb-wrap-lines\"><span class=\"hljs-selector-tag\">cl<\/span><span class=\"hljs-selector-class\">.url<\/span>( \"<span class=\"hljs-selector-tag\">elephants<\/span><span class=\"hljs-selector-class\">.jpg<\/span>\", {<span class=\"hljs-attribute\">crop<\/span>: <span class=\"hljs-string\">\"scale\"<\/span>, width: <span class=\"hljs-number\">500<\/span>});\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<p><cld-code-widget\n      class=\" c-code-widget\"\n      snippets=\"[]\"\n      parsed-url=\"{&quot;url&quot;:&quot;https:\\\/\\\/res.cloudinary.com\\\/demo\\\/image\\\/upload\\\/c_scale,w_500\\\/elephants.jpg&quot;,&quot;cloud_name&quot;:&quot;demo&quot;,&quot;host&quot;:&quot;res.cloudinary.com&quot;,&quot;type&quot;:&quot;upload&quot;,&quot;resource_type&quot;:&quot;image&quot;,&quot;transformation&quot;:[{&quot;crop_mode&quot;:&quot;scale&quot;,&quot;width&quot;:&quot;500&quot;}],&quot;transformation_string&quot;:&quot;c_scale,w_500&quot;,&quot;url_suffix&quot;:&quot;&quot;,&quot;version&quot;:&quot;&quot;,&quot;secure&quot;:true,&quot;public_id&quot;:&quot;elephants.jpg&quot;,&quot;extension&quot;:&quot;jpg&quot;,&quot;format&quot;:&quot;jpg&quot;,&quot;format_code&quot;:true,&quot;url_code&quot;:false,&quot;signature&quot;:&quot;&quot;,&quot;private_cdn&quot;:false,&quot;result_asset_type&quot;:&quot;image&quot;}\"\n      with-url=\"true\"\n    >\n      <span class=\"u-visually-hidden\">Loading code examples<\/span>\n    <\/cld-code-widget><a class=\"c-image-link\" href=\"https:\/\/res.cloudinary.com\/demo\/image\/upload\/c_scale,w_500\/elephants.jpg\" target=\"_blank\"><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/demo\/image\/upload\/c_scale,w_500\/elephants.jpg\" alt=\"Scaled down elephants image to 500 pixels\" loading=\"lazy\" class=\"c-transformed-asset\"  width=\"500\" height=\"278\"\/><\/a><\/p>\n<p>You can also generate the entire image tag:<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml shcb-wrap-lines\">cl.image( \"elephants.jpg\", {crop: \"scale\", width: 500});\n\/\/ <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">img<\/span> <span class=\"hljs-attr\">src<\/span>=<span class=\"hljs-string\">\"https:\/\/res.cloudinary.com\/demo\/image\/upload\/c_scale,w_500\/elephants.jpg\"<\/span> <span class=\"hljs-attr\">width<\/span>=<span class=\"hljs-string\">\"500\"<\/span>&gt;<\/span>\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<p>For more artistic results:<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php shcb-wrap-lines\"><span class=\"hljs-keyword\">var<\/span> artistic = Transformation.<span class=\"hljs-keyword\">new<\/span>()\n       .crop(<span class=\"hljs-string\">\"scale\"<\/span>)\n       .width(<span class=\"hljs-number\">500<\/span>)\n       .radius(<span class=\"hljs-string\">\"max\"<\/span>)\n       .effect(<span class=\"hljs-string\">\"oil_paint:50\"<\/span>);\n\ncl.image(<span class=\"hljs-string\">\"elephants.jpg\"<\/span>, artistic);\n<span class=\"hljs-comment\">\/\/ &lt;img src=\"https:\/\/res.cloudinary.com\/demo\/image\/upload\/c_scale,e_oil_paint:50,r_max,w_500\/elephants.jpg\" &gt;<\/span>\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<p><cld-code-widget\n      class=\" c-code-widget\"\n      snippets=\"[]\"\n      parsed-url=\"{&quot;url&quot;:&quot;https:\\\/\\\/res.cloudinary.com\\\/demo\\\/image\\\/upload\\\/c_scale,e_oil_paint:50,r_max,w_500\\\/elephants.jpg&quot;,&quot;cloud_name&quot;:&quot;demo&quot;,&quot;host&quot;:&quot;res.cloudinary.com&quot;,&quot;type&quot;:&quot;upload&quot;,&quot;resource_type&quot;:&quot;image&quot;,&quot;transformation&quot;:[{&quot;crop_mode&quot;:&quot;scale&quot;,&quot;effect&quot;:&quot;oil_paint:50&quot;,&quot;radius&quot;:&quot;max&quot;,&quot;width&quot;:&quot;500&quot;}],&quot;transformation_string&quot;:&quot;c_scale,e_oil_paint:50,r_max,w_500&quot;,&quot;url_suffix&quot;:&quot;&quot;,&quot;version&quot;:&quot;&quot;,&quot;secure&quot;:true,&quot;public_id&quot;:&quot;elephants.jpg&quot;,&quot;extension&quot;:&quot;jpg&quot;,&quot;format&quot;:&quot;jpg&quot;,&quot;format_code&quot;:true,&quot;url_code&quot;:false,&quot;signature&quot;:&quot;&quot;,&quot;private_cdn&quot;:false,&quot;result_asset_type&quot;:&quot;image&quot;}\"\n      with-url=\"true\"\n    >\n      <span class=\"u-visually-hidden\">Loading code examples<\/span>\n    <\/cld-code-widget><a class=\"c-image-link\" href=\"https:\/\/res.cloudinary.com\/demo\/image\/upload\/c_scale,e_oil_paint:50,r_max,w_500\/elephants.jpg\" target=\"_blank\"><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/demo\/image\/upload\/c_scale,e_oil_paint:50,r_max,w_500\/elephants.jpg\" alt=\"Oil paint image effect\" loading=\"lazy\" class=\"c-transformed-asset\"  width=\"500\" height=\"278\"\/><\/a><\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml shcb-wrap-lines\">cl.image(\"horses.jpg\", artistic);\n\/\/ <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">img<\/span> <span class=\"hljs-attr\">src<\/span>=<span class=\"hljs-string\">\"https:\/\/res.cloudinary.com\/demo\/image\/upload\/c_scale,e_oil_paint:50,r_max,w_500\/horses.jpg\"<\/span> &gt;<\/span>\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<p><cld-code-widget\n      class=\" c-code-widget\"\n      snippets=\"[]\"\n      parsed-url=\"{&quot;url&quot;:&quot;https:\\\/\\\/res.cloudinary.com\\\/demo\\\/image\\\/upload\\\/c_scale,e_oil_paint:50,r_max,w_500\\\/horses.jpg&quot;,&quot;cloud_name&quot;:&quot;demo&quot;,&quot;host&quot;:&quot;res.cloudinary.com&quot;,&quot;type&quot;:&quot;upload&quot;,&quot;resource_type&quot;:&quot;image&quot;,&quot;transformation&quot;:[{&quot;crop_mode&quot;:&quot;scale&quot;,&quot;effect&quot;:&quot;oil_paint:50&quot;,&quot;radius&quot;:&quot;max&quot;,&quot;width&quot;:&quot;500&quot;}],&quot;transformation_string&quot;:&quot;c_scale,e_oil_paint:50,r_max,w_500&quot;,&quot;url_suffix&quot;:&quot;&quot;,&quot;version&quot;:&quot;&quot;,&quot;secure&quot;:true,&quot;public_id&quot;:&quot;horses.jpg&quot;,&quot;extension&quot;:&quot;jpg&quot;,&quot;format&quot;:&quot;jpg&quot;,&quot;format_code&quot;:true,&quot;url_code&quot;:false,&quot;signature&quot;:&quot;&quot;,&quot;private_cdn&quot;:false,&quot;result_asset_type&quot;:&quot;image&quot;}\"\n      with-url=\"true\"\n    >\n      <span class=\"u-visually-hidden\">Loading code examples<\/span>\n    <\/cld-code-widget><a class=\"c-image-link\" href=\"https:\/\/res.cloudinary.com\/demo\/image\/upload\/c_scale,e_oil_paint:50,r_max,w_500\/horses.jpg\" target=\"_blank\"><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/demo\/image\/upload\/c_scale,e_oil_paint:50,r_max,w_500\/horses.jpg\" alt=\"Oil paint effect of the horses photo\" loading=\"lazy\" class=\"c-transformed-asset\"  width=\"500\" height=\"333\"\/><\/a><\/p>\n<p>See what I mean?<\/p>\n<p>In addition, the SDK provides the functionality required to <a href=\"https:\/\/cloudinary.com\/blog\/direct_upload_made_easy_from_browser_or_mobile_app_to_the_cloud\">upload images from the browser directly to the cloud<\/a>, and apply <a href=\"https:\/\/cloudinary.com\/blog\/how_to_automatically_create_images_for_responsive_design\">responsive<\/a> behavior to the displayed images. For more information on the available SDKs and media transformation options, see <a href=\"https:\/\/cloudinary.com\/documentation\">Cloudinary\u2019s documentation<\/a>.<\/p>\n<h2>Main Features<\/h2>\n<p>The Cloudinary JavaScript library functionality is represented using several classes.<\/p>\n<p>The main class, Cloudinary, provides an API for:<\/p>\n<ul>\n<li>Generating resource URLs.<\/li>\n<li>Generating HTML.<\/li>\n<li>Generating transformation strings.<\/li>\n<li>Enabling responsive behavior.<\/li>\n<\/ul>\n<p>In addition, other classes encapsulate specific behavior:<\/p>\n<ul>\n<li>Transformation &#8211; generates and represents transformations.<\/li>\n<li>Configuration &#8211; manages the Cloudinary API configuration.<\/li>\n<li>HtmlTag, ImageTag, VideoTag &#8211; generates HTML tags.<\/li>\n<li>Util &#8211; various utility functions.<\/li>\n<\/ul>\n<p>After providing basic configuration values, the API is ready to be used.<\/p>\n<p>Here are a few examples:<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript shcb-wrap-lines\"><span class=\"hljs-keyword\">var<\/span> cl = cloudinary.Cloudinary.new( { <span class=\"hljs-attr\">cloud_name<\/span>: <span class=\"hljs-string\">\"demo\"<\/span>});\n\n<span class=\"hljs-keyword\">var<\/span> d = <span class=\"hljs-built_in\">document<\/span>.getElementById(<span class=\"hljs-string\">\"my_div\"<\/span>);\n\nd.appendChild( cl.imageTag(<span class=\"hljs-string\">\"sample\"<\/span>, {<span class=\"hljs-attr\">crop<\/span>: <span class=\"hljs-string\">\"scale\"<\/span>, <span class=\"hljs-attr\">width<\/span>: <span class=\"hljs-number\">200<\/span>}).toDOM());\n\n<span class=\"hljs-keyword\">var<\/span> i = <span class=\"hljs-built_in\">document<\/span>.getElementById(\u201cmy_image\u201d);\n\ni.src = cl.url( <span class=\"hljs-string\">\"sample\"<\/span>, {<span class=\"hljs-attr\">crop<\/span>: <span class=\"hljs-string\">\"scale\"<\/span>, <span class=\"hljs-attr\">width<\/span>: <span class=\"hljs-number\">200<\/span>, <span class=\"hljs-attr\">angle<\/span>: <span class=\"hljs-number\">30<\/span>});\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<h2>Rejuvenating a library<\/h2>\n<p>When we first wrote our JavaScript library, it was designed as a jQuery plugin. Virtually all JavaScript developers are familiar with jQuery: it is one of the most popular JavaScript libraries and has a large following. It is designed by and large for client side HTML\/DOM transformation, but includes many useful general purpose functions. jQuery takes the hassle away from many of the woes of web development and has served developers well. The jQuery library also provides browser compatibility by handling special cases and ensuring that the JavaScript code will run on virtually all clients.<\/p>\n<p>However with the recent rise in the number of JavaScript libraries, frameworks and, well, tastes, we have also received many requests to create a jQuery-less library.<\/p>\n<p>The decisions facing one in the task of redesigning a JavaScript library are numerous and daunting. Backward compatibility vs. a clean break? native JavaScript vs. CoffeeScript \/ TypeScript? lodash, underscore, or implement your own solutions? Npm, Bower or both? Grunt, Gulp, npm? RequireJS, CommonJS, webpack, browserify? &#8211; well, you get the point.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/cloudinary\/image\/upload\/t_js_libs\/w_1200\/blog\/js_logo.png\" alt=\"Javascript framework and tools\" loading=\"lazy\" class=\"c-transformed-asset\"  width=\"600\" height=\"408\"\/><\/p>\n<p><em><strong>Too many choices<\/strong><\/em><\/p>\n<p>Needless to say each choice you make will provoke praise from one camp and battle cries from the other\u2026<\/p>\n<h2>Backward Compatibility<\/h2>\n<p>Backward compatibility is obviously a big issue. Our philosophy is to let our customers enjoy new features with minimal code changes &#8211; if any. The nature of our service also requires that our libraries support a wider range of platforms and browser versions than normally needed. To this end, the new library was designed to be a drop-in replacement to the existing library. This decision has put some constraints on the design of the library &#8211; but we were happy (and proud) to have accomplished it in full.<\/p>\n<p>Old version:<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript shcb-wrap-lines\">$.cloudinary.url(\u201cmy_image\u201d, {<span class=\"hljs-attr\">width<\/span>: <span class=\"hljs-number\">100<\/span>});\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<p>New version:<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript shcb-wrap-lines\">$.cloudinary.url(\u201cmy_image\u201d, {<span class=\"hljs-attr\">width<\/span>: <span class=\"hljs-number\">100<\/span>});\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<p><em><strong>Backward compatibility, anyone? the new library is a drop-in replacement.<\/strong><\/em><\/p>\n<p>The cloudinary_js library is provided in plain javascript 5. This is important to ensure it will run smoothly regardless of the browser the end user is using. During the development phase, it is often easier to code in a higher function variation of the language.<\/p>\n<p>Early on we made the decision to write the new code in CoffeeScript. While ES2015 (the artist formally known as ES6) was already rolling out, maintaining backward compatibility meant that we would have to \u201ccompile\u201d the code anyway. CoffeeScript has its own shortcomings but its familiarity to Rails developers, and the fact the our NodeJS library was written in CoffeeScript, made it a comfortable choice. Besides, <a href=\"http:\/\/coffeescript.org\/#loops\">comprehensions<\/a> are cool!<\/p>\n<p>CoffeeScript and ES2015 both allow the creation of classes and objects. Syntax may vary (as does the implementation of class inheritance) but the result is similar. In fact both are mainly syntactic-sugar to a functionality that already existed in \u201cnative\u201d JavaScript.<\/p>\n<p>The new library groups functionality into classes. One of the neat benefits is the ability to chain function calls, making the code more descriptive.<\/p>\n<p>The following code, for example, configures the Cloudinary API to use the cloud \u201cdemo\u201d.<\/p>\n<p>It then creates an image tag for the \u201csample\u201d image, scaled to a width of 150px, rotated by 15 degrees, and with the \u201csepia\u201d effect applied.<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php shcb-wrap-lines\"><span class=\"hljs-keyword\">var<\/span> cl = cloudinary.Cloudinary.<span class=\"hljs-keyword\">new<\/span>({cloud_name: <span class=\"hljs-string\">\"demo\"<\/span>});\n<span class=\"hljs-keyword\">var<\/span> tag = cl.imageTag(<span class=\"hljs-string\">\"sample\"<\/span>).transformation()\n   .width(<span class=\"hljs-number\">150<\/span>)\n   .crop(<span class=\"hljs-string\">\"scale\"<\/span>)\n   .angle(<span class=\"hljs-number\">15<\/span>)\n   .effect(<span class=\"hljs-string\">'sepia'<\/span>);\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<p>Since the code is object oriented (rather than global as in the previous version), it is easy to utilize multiple clouds and accounts in the same application.<\/p>\n<p>The following code creates two image tags drawn from two different clouds (note that while the public ID of the image is the same these could be two completely different images as they are defined in separate clouds).<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-9\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php shcb-wrap-lines\"><span class=\"hljs-keyword\">var<\/span> someCloud = cloudinary.Cloudinary.<span class=\"hljs-keyword\">new<\/span>( {cloud_name: <span class=\"hljs-string\">\"someCloud\"<\/span>, secure: <span class=\"hljs-keyword\">true<\/span>});\n<span class=\"hljs-keyword\">var<\/span> otherCloud = cloudinary.Cloudinary.<span class=\"hljs-keyword\">new<\/span>( {cloud_name: <span class=\"hljs-string\">\"otherCloud\"<\/span>});\n\nsomeCloud.imageTag(<span class=\"hljs-string\">\"sample.jpg\"<\/span>); <span class=\"hljs-comment\">\/\/ &lt;img src=\"https:\/\/res.cloudinary.com\/someCloud\/image\/upload\/sample.jpg\"&gt;<\/span>\notherCloud.imageTag(<span class=\"hljs-string\">\"sample.jpg\"<\/span>); <span class=\"hljs-comment\">\/\/ &lt;img src=\"https:\/\/res.cloudinary.com\/otherCloud\/image\/upload\/sample.jpg\"&gt;<\/span>\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-9\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<h2>Utility functions<\/h2>\n<p>The JavaScript language has limitations, be it array transformation or determining an \u201cempty\u201d value. Some of these limitations were addressed in ES2015, but as a JavaScript developer you always have to be on your toes making sure that the feature you are using will be supported in all foreseeable environments.<\/p>\n<p>Libraries such as lodash take the edge off by providing an implementation of features when the runtime environment does not support them. Because jQuery support was still required for the Cloudinary jQuery plugin, and because we anticipated frowns on the use of lodash, we designed the library so that lodash is not called directly but through the \u201cutil\u201d interface. This allows us to switch between jQuery and lodash when needed. It also allows for the future utilization of a different library, or for a keen programmer to implement \u201cnative\u201d code and make the library become fully standalone.<\/p>\n<p>We also created a special shrinkwrapped version of the library which includes a subset of the lodash functions that are required by Cloudinary. The resulting single file is about half the size of a full sourced lodash + Cloudinary.<\/p>\n<p>Uploading a file using JavaScript is basically not a difficult task, but it gets complex quickly and deeply so. To avoid this we have relied in the past on Blueimp\u2019s excellent jQuery-file-upload library. For both backward compatibility and the fact that this library does what it does well, we decided to keep using it. As much as this library is useful however, you can still utilize other upload libraries or write your own code to upload files from the core library. See<a href=\"https:\/\/jsfiddle.net\/tocker\/fpoca4c8\/\"> this example<\/a> of a pure JavaScript upload to Cloudinary.<\/p>\n<h2>New source repositories<\/h2>\n<p>There are two common ways to manage dependent libraries in JavaScript: npm and bower. Originally, bower handled client side libraries while npm, as its name suggests (Node Package Manager) was managing server side libraries. Today npm is used to manage client side libraries too. In fact jQuery, which used to have its own repository, moved its plugins to npm.<\/p>\n<p>In order to serve both the core library and the jQuery variant we had to create 3 new github repositories. The main reason was that bower relies directly on the github release information, which means you cannot serve two packages from the same repository.<\/p>\n<p>The main repository which includes the source code, issues and pull requests for the Cloudinary JavaScript library is located at <a href=\"https:\/\/github.com\/cloudinary\/cloudinary_js\">cloudinary_js<\/a>. In order to support existing websites that relied on the previous version of this library, it includes a backward compatible distribution format.<\/p>\n<p>The new JavaScript API is provided in 3 distribution packages:<\/p>\n<table style=\"border: none; border-collapse: collapse;\"><colgroup><col width=\"33%\" \/><col width=\"33%\" \/><col width=\"33%\" \/><\/colgroup>\n<tbody>\n<tr style=\"height: 0px;\">\n<td style=\"vertical-align: top; padding: 7px 13px 7px 13px; border: solid #dddddd 1px;\">\n<p style=\"line-height: 1.9200000000000004; margin-top: 0pt; margin-bottom: 0pt; text-align: center;\" dir=\"ltr\"><span style=\"font-size: 13.3333px; font-family: Arial; color: #333333; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;\">Github Repository<\/span><\/p>\n<\/td>\n<td style=\"vertical-align: top; padding: 7px 13px 7px 13px; border: solid #dddddd 1px;\">\n<p style=\"line-height: 1.9200000000000004; margin-top: 0pt; margin-bottom: 0pt; text-align: center;\" dir=\"ltr\"><span style=\"font-size: 13.3333px; font-family: Arial; color: #333333; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;\">Package name<\/span><\/p>\n<\/td>\n<td style=\"vertical-align: top; padding: 7px 13px 7px 13px; border: solid #dddddd 1px;\">\n<p style=\"line-height: 1.9200000000000004; margin-top: 0pt; margin-bottom: 0pt; text-align: center;\" dir=\"ltr\"><span style=\"font-size: 13.3333px; font-family: Arial; color: #333333; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;\">Description<\/span><\/p>\n<\/td>\n<\/tr>\n<tr style=\"height: 0px;\">\n<td style=\"vertical-align: top; padding: 7px 13px 7px 13px; border: solid #dddddd 1px;\">\n<p style=\"line-height: 1.9200000000000004; margin-top: 0pt; margin-bottom: 0pt;\" dir=\"ltr\"><a style=\"text-decoration: none;\" href=\"https:\/\/github.com\/cloudinary\/pkg-cloudinary-core\"><span style=\"font-size: 13.3333px; font-family: Arial; color: #4078c0; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;\">pkg-cloudinary-core<\/span><\/a><\/p>\n<\/td>\n<td style=\"vertical-align: top; padding: 7px 13px 7px 13px; border: solid #dddddd 1px;\">\n<p style=\"line-height: 1.9200000000000004; margin-top: 0pt; margin-bottom: 0pt;\" dir=\"ltr\"><span style=\"font-size: 13.3333px; font-family: Consolas; color: #333333; vertical-align: baseline; white-space: pre-wrap;\">cloudinary-core<\/span><\/p>\n<\/td>\n<td style=\"vertical-align: top; padding: 7px 13px 7px 13px; border: solid #dddddd 1px;\">\n<p style=\"line-height: 1.9200000000000004; margin-top: 0pt; margin-bottom: 0pt;\" dir=\"ltr\"><span style=\"font-size: 13.3333px; font-family: Arial; color: #333333; vertical-align: baseline; white-space: pre-wrap;\">Core Cloudinary Library.<\/span><\/p>\n<p style=\"line-height: 1.9200000000000004; margin-top: 0pt; margin-bottom: 0pt;\" dir=\"ltr\"><span style=\"font-size: 13.3333px; font-family: Arial; color: #333333; vertical-align: baseline; white-space: pre-wrap;\">Use this if you do not intend to use jQuery.<\/span><\/p>\n<\/td>\n<\/tr>\n<tr style=\"height: 0px;\">\n<td style=\"vertical-align: top; padding: 7px 13px 7px 13px; border: solid #dddddd 1px;\">\n<p style=\"line-height: 1.9200000000000004; margin-top: 0pt; margin-bottom: 0pt;\" dir=\"ltr\"><a style=\"text-decoration: none;\" href=\"https:\/\/github.com\/cloudinary\/pkg-cloudinary-jquery\"><span style=\"font-size: 13.3333px; font-family: Arial; color: #4078c0; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;\">pkg-cloudinary-jquery<\/span><\/a><\/p>\n<\/td>\n<td style=\"vertical-align: top; padding: 7px 13px 7px 13px; border: solid #dddddd 1px;\">\n<p style=\"line-height: 1.9200000000000004; margin-top: 0pt; margin-bottom: 0pt;\" dir=\"ltr\"><span style=\"font-size: 13.3333px; font-family: Consolas; color: #333333; vertical-align: baseline; white-space: pre-wrap;\">cloudinary-jquery<\/span><\/p>\n<\/td>\n<td style=\"vertical-align: top; padding: 7px 13px 7px 13px; border: solid #dddddd 1px;\">\n<p style=\"line-height: 1.9200000000000004; margin-top: 0pt; margin-bottom: 0pt;\" dir=\"ltr\"><span style=\"font-size: 13.3333px; font-family: Arial; color: #333333; vertical-align: baseline; white-space: pre-wrap;\">Core Library + jQuery plugin<\/span><\/p>\n<\/td>\n<\/tr>\n<tr style=\"height: 0px;\">\n<td style=\"vertical-align: top; padding: 7px 13px 7px 13px; border: solid #dddddd 1px;\">\n<p style=\"line-height: 1.9200000000000004; margin-top: 0pt; margin-bottom: 0pt;\" dir=\"ltr\"><a style=\"text-decoration: none;\" href=\"https:\/\/github.com\/cloudinary\/pkg-cloudinary-jquery-file-upload\"><span style=\"font-size: 13.3333px; font-family: Arial; color: #4078c0; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;\">pkg-cloudinary-jquery-file-upload<\/span><\/a><\/p>\n<\/td>\n<td style=\"vertical-align: top; padding: 7px 13px 7px 13px; border: solid #dddddd 1px;\">\n<p style=\"line-height: 1.9200000000000004; margin-top: 0pt; margin-bottom: 0pt;\" dir=\"ltr\"><span style=\"font-size: 13.3333px; font-family: Consolas; color: #333333; vertical-align: baseline; white-space: pre-wrap;\">cloudinary-jquery-file-upload<\/span><\/p>\n<\/td>\n<td style=\"vertical-align: top; padding: 7px 13px 7px 13px; border: solid #dddddd 1px;\">\n<p style=\"line-height: 1.9200000000000004; margin-top: 0pt; margin-bottom: 0pt;\" dir=\"ltr\"><span style=\"font-size: 13.3333px; font-family: Arial; color: #333333; vertical-align: baseline; white-space: pre-wrap;\">Core Library + jQuery plugin <\/span><\/p>\n<p style=\"line-height: 1.9200000000000004; margin-top: 0pt; margin-bottom: 0pt;\" dir=\"ltr\"><span style=\"font-size: 13.3333px; font-family: Arial; color: #333333; vertical-align: baseline; white-space: pre-wrap;\">+ Blueimp File Upload adapter<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>The same package names are used in both bower and NPM.<\/p>\n<p>This API reference is generated directly from the code and complements the documentation on our main website.<\/p>\n<h2>Summary<\/h2>\n<p>The management of images and other media resources is an important part of modern web and mobile development. The Cloudinary JavaScript library significantly reduces the workload by automating the transformation and delivery of the resources.<\/p>\n<p>The new version of the library includes 3 distributions: the core library, the jQuery plugin, and the <a href=\"https:\/\/cloudinary.com\/blog\/automating_file_upload_and_sharing\">File Upload<\/a> plugin.<\/p>\n<p>The library also introduces a new API that allows the developer to chain function calls and use multiple accounts in the same application.<\/p>\n<p>Head over and give it a try at <a href=\"https:\/\/github.com\/cloudinary\/cloudinary_js\">cloudinary_js<\/a>!<\/p>\n<p>We\u2019re looking forward to hearing your impressions!<\/p>\n<div style=\"margin-top: 11px; color: #666; font-size: 10px\">\nElephants image is under <a href=\"https:\/\/creativecommons.org\/about\/cc0\/\" target=\"_blank\" rel=\"nofollow\">CC0<\/a> license. The source of the image is <a href=\"https:\/\/pixabay.com\/en\/elephant-herd-of-elephants-279505\/\" target=\"_blank\" rel=\"nofollow\">here<\/a>.\n<\/div>  \n<\/div>","protected":false},"excerpt":{"rendered":"","protected":false},"author":41,"featured_media":21361,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_cloudinary_featured_overwrite":false,"footnotes":""},"categories":[1],"tags":[119,145,177,183],"class_list":["post-21360","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-file-upload","tag-html5","tag-javascript","tag-jquery"],"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>Automated JavaScript Image Transformation and Management<\/title>\n<meta name=\"description\" content=\"Cloudinary&#039;s JavaScript image transformation and management library accelerates web development with a few lines of code\" \/>\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\/painless_image_and_video_manipulation_with_javascript\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Automated JavaScript Image Transformation and Management\" \/>\n<meta property=\"og:description\" content=\"Cloudinary&#039;s JavaScript image transformation and management library accelerates web development with a few lines of code\" \/>\n<meta property=\"og:url\" content=\"https:\/\/cloudinary.com\/blog\/painless_image_and_video_manipulation_with_javascript\" \/>\n<meta property=\"og:site_name\" content=\"Cloudinary Blog\" \/>\n<meta property=\"article:published_time\" content=\"2016-03-10T13:24:04+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-06-01T17:28:07+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/v1649732897\/Web_Assets\/blog\/cloudinary_javascript_library_post\/cloudinary_javascript_library_post-jpg?_i=AA\" \/>\n\t<meta property=\"og:image:width\" content=\"300\" \/>\n\t<meta property=\"og:image:height\" content=\"192\" \/>\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\/painless_image_and_video_manipulation_with_javascript#article\",\"isPartOf\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/painless_image_and_video_manipulation_with_javascript\"},\"author\":{\"name\":\"\",\"@id\":\"\"},\"headline\":\"Automated JavaScript Image Transformation and Management\",\"datePublished\":\"2016-03-10T13:24:04+00:00\",\"dateModified\":\"2024-06-01T17:28:07+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/painless_image_and_video_manipulation_with_javascript\"},\"wordCount\":6,\"publisher\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/painless_image_and_video_manipulation_with_javascript#primaryimage\"},\"thumbnailUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649732897\/Web_Assets\/blog\/cloudinary_javascript_library_post\/cloudinary_javascript_library_post.jpg?_i=AA\",\"keywords\":[\"File-upload\",\"HTML5\",\"Javascript\",\"jQuery\"],\"inLanguage\":\"en-US\",\"copyrightYear\":\"2016\",\"copyrightHolder\":{\"@id\":\"https:\/\/cloudinary.com\/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/cloudinary.com\/blog\/painless_image_and_video_manipulation_with_javascript\",\"url\":\"https:\/\/cloudinary.com\/blog\/painless_image_and_video_manipulation_with_javascript\",\"name\":\"Automated JavaScript Image Transformation and Management\",\"isPartOf\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/painless_image_and_video_manipulation_with_javascript#primaryimage\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/painless_image_and_video_manipulation_with_javascript#primaryimage\"},\"thumbnailUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649732897\/Web_Assets\/blog\/cloudinary_javascript_library_post\/cloudinary_javascript_library_post.jpg?_i=AA\",\"datePublished\":\"2016-03-10T13:24:04+00:00\",\"dateModified\":\"2024-06-01T17:28:07+00:00\",\"description\":\"Cloudinary's JavaScript image transformation and management library accelerates web development with a few lines of code\",\"breadcrumb\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/painless_image_and_video_manipulation_with_javascript#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/cloudinary.com\/blog\/painless_image_and_video_manipulation_with_javascript\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cloudinary.com\/blog\/painless_image_and_video_manipulation_with_javascript#primaryimage\",\"url\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649732897\/Web_Assets\/blog\/cloudinary_javascript_library_post\/cloudinary_javascript_library_post.jpg?_i=AA\",\"contentUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649732897\/Web_Assets\/blog\/cloudinary_javascript_library_post\/cloudinary_javascript_library_post.jpg?_i=AA\",\"width\":300,\"height\":192},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/cloudinary.com\/blog\/painless_image_and_video_manipulation_with_javascript#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/cloudinary.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Automated JavaScript Image Transformation and Management\"}]},{\"@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":"Automated JavaScript Image Transformation and Management","description":"Cloudinary's JavaScript image transformation and management library accelerates web development with a few lines of code","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\/painless_image_and_video_manipulation_with_javascript","og_locale":"en_US","og_type":"article","og_title":"Automated JavaScript Image Transformation and Management","og_description":"Cloudinary's JavaScript image transformation and management library accelerates web development with a few lines of code","og_url":"https:\/\/cloudinary.com\/blog\/painless_image_and_video_manipulation_with_javascript","og_site_name":"Cloudinary Blog","article_published_time":"2016-03-10T13:24:04+00:00","article_modified_time":"2024-06-01T17:28:07+00:00","og_image":[{"width":300,"height":192,"url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/v1649732897\/Web_Assets\/blog\/cloudinary_javascript_library_post\/cloudinary_javascript_library_post-jpg?_i=AA","type":"image\/jpeg"}],"twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"NewsArticle","@id":"https:\/\/cloudinary.com\/blog\/painless_image_and_video_manipulation_with_javascript#article","isPartOf":{"@id":"https:\/\/cloudinary.com\/blog\/painless_image_and_video_manipulation_with_javascript"},"author":{"name":"","@id":""},"headline":"Automated JavaScript Image Transformation and Management","datePublished":"2016-03-10T13:24:04+00:00","dateModified":"2024-06-01T17:28:07+00:00","mainEntityOfPage":{"@id":"https:\/\/cloudinary.com\/blog\/painless_image_and_video_manipulation_with_javascript"},"wordCount":6,"publisher":{"@id":"https:\/\/cloudinary.com\/blog\/#organization"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/painless_image_and_video_manipulation_with_javascript#primaryimage"},"thumbnailUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649732897\/Web_Assets\/blog\/cloudinary_javascript_library_post\/cloudinary_javascript_library_post.jpg?_i=AA","keywords":["File-upload","HTML5","Javascript","jQuery"],"inLanguage":"en-US","copyrightYear":"2016","copyrightHolder":{"@id":"https:\/\/cloudinary.com\/#organization"}},{"@type":"WebPage","@id":"https:\/\/cloudinary.com\/blog\/painless_image_and_video_manipulation_with_javascript","url":"https:\/\/cloudinary.com\/blog\/painless_image_and_video_manipulation_with_javascript","name":"Automated JavaScript Image Transformation and Management","isPartOf":{"@id":"https:\/\/cloudinary.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/cloudinary.com\/blog\/painless_image_and_video_manipulation_with_javascript#primaryimage"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/painless_image_and_video_manipulation_with_javascript#primaryimage"},"thumbnailUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649732897\/Web_Assets\/blog\/cloudinary_javascript_library_post\/cloudinary_javascript_library_post.jpg?_i=AA","datePublished":"2016-03-10T13:24:04+00:00","dateModified":"2024-06-01T17:28:07+00:00","description":"Cloudinary's JavaScript image transformation and management library accelerates web development with a few lines of code","breadcrumb":{"@id":"https:\/\/cloudinary.com\/blog\/painless_image_and_video_manipulation_with_javascript#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/cloudinary.com\/blog\/painless_image_and_video_manipulation_with_javascript"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudinary.com\/blog\/painless_image_and_video_manipulation_with_javascript#primaryimage","url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649732897\/Web_Assets\/blog\/cloudinary_javascript_library_post\/cloudinary_javascript_library_post.jpg?_i=AA","contentUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649732897\/Web_Assets\/blog\/cloudinary_javascript_library_post\/cloudinary_javascript_library_post.jpg?_i=AA","width":300,"height":192},{"@type":"BreadcrumbList","@id":"https:\/\/cloudinary.com\/blog\/painless_image_and_video_manipulation_with_javascript#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/cloudinary.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Automated JavaScript Image Transformation and Management"}]},{"@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\/v1649732897\/Web_Assets\/blog\/cloudinary_javascript_library_post\/cloudinary_javascript_library_post.jpg?_i=AA","_links":{"self":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/21360","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=21360"}],"version-history":[{"count":1,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/21360\/revisions"}],"predecessor-version":[{"id":34209,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/21360\/revisions\/34209"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/media\/21361"}],"wp:attachment":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/media?parent=21360"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/categories?post=21360"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/tags?post=21360"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}