{"id":28058,"date":"2022-04-25T06:34:15","date_gmt":"2022-04-25T06:34:15","guid":{"rendered":"http:\/\/how-to-crop-and-resize-image-in-the-browser-with-react"},"modified":"2025-02-16T13:09:29","modified_gmt":"2025-02-16T21:09:29","slug":"how-to-crop-and-resize-image-in-the-browser-with-react","status":"publish","type":"post","link":"https:\/\/cloudinary.com\/blog\/guest_post\/how-to-crop-and-resize-image-in-the-browser-with-react\/","title":{"rendered":"How to Crop and Resize Image in the Browser"},"content":{"rendered":"<div class=\"wp-block-cloudinary-markdown \"><p>Cropping an image is typically done to remove an unattractive subject or extraneous information, adjust the aspect ratio of an image, or sometimes magnify the main topic and reduce the angle of view.<\/p>\n<p>This article will show you how to crop and resize an image in the browser with React.<\/p>\n<p>The completed project is on <a href=\"https:\/\/codesandbox.io\/s\/xenodochial-hoover-eiiuws?file=\/src\/App.js\">Codesandbox<\/a>.<\/p>\n<h1>Prerequisite<\/h1>\n<p>The knowledge of JavaScript and React.js is required to follow through with this article. Also, you need to ensure that you have <a href=\"https:\/\/nodejs.org\/en\/\">Node.js<\/a> and npm installed to follow along.<\/p>\n<p>To Verify the node version installed,  use the following terminal command:<\/p>\n<pre class=\"js-syntax-highlighted\"><span><code class=\"hljs shcb-wrap-lines\">node -v &amp;&amp; npm -v \n<\/code><\/span><\/pre>\n<p>The above command should output their respective versions if installed.<\/p>\n<h2>Project Setup<\/h2>\n<p>To create a new project, use the <code>npx create-react-app &lt;project name&gt;<\/code> command to scaffold a new project in a directory of your choice.<\/p>\n<p>To install the dependencies, you should use the command below:<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml shcb-wrap-lines\">cd <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">project<\/span> <span class=\"hljs-attr\">name<\/span>&gt;<\/span>\nnpm install react-cropper\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><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>Once the app is created, and the dependencies are installed, you will see a message with instructions for navigating to your site and running it locally. You can do this with the following command.<\/p>\n<pre class=\"js-syntax-highlighted\"><span><code class=\"hljs shcb-wrap-lines\">npm start\n<\/code><\/span><\/pre>\n<p>React.js will start a hot-reloading development environment accessible by default at <a href=\"http:\/\/localhost:3000\">http:\/\/localhost:3000<\/a>.<\/p>\n<p>Next, update the <code>src\/App.js<\/code> file with the code snippet below.<\/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\">#App.js\n    \nimport React, { useState } from \"react\";\nimport \".\/styles.css\";\n    \nexport default function App() {\n  return (\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span>&gt;<\/span>\n      <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">className<\/span>=<span class=\"hljs-string\">\"splitdiv\"<\/span> <span class=\"hljs-attr\">id<\/span>=<span class=\"hljs-string\">\"leftdiv\"<\/span>&gt;<\/span>\n        <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">h1<\/span> <span class=\"hljs-attr\">className<\/span>=<span class=\"hljs-string\">\"main-h1\"<\/span>&gt;<\/span>\n            How to Crop and Resize Image in the Browser using CropperJs\n        <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">h1<\/span>&gt;<\/span>\n        <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">id<\/span>=<span class=\"hljs-string\">\"leftdivcard\"<\/span>&gt;<\/span>\n          <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">input<\/span> <span class=\"hljs-attr\">type<\/span>=<span class=\"hljs-string\">\"file\"<\/span> \/&gt;<\/span>\n          <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">button<\/span> <span class=\"hljs-attr\">type<\/span>=<span class=\"hljs-string\">\"button\"<\/span> <span class=\"hljs-attr\">id<\/span>=<span class=\"hljs-string\">\"leftbutton\"<\/span>&gt;<\/span>\n            Use Default Image\n          <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">button<\/span>&gt;<\/span>\n            <span class=\"hljs-symbol\">&amp;nbsp;<\/span> <span class=\"hljs-symbol\">&amp;nbsp;<\/span>\n          <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">button<\/span> <span class=\"hljs-attr\">type<\/span>=<span class=\"hljs-string\">\"button\"<\/span> <span class=\"hljs-attr\">id<\/span>=<span class=\"hljs-string\">\"leftbutton\"<\/span>&gt;<\/span>\n            Crop Image\n          <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">button<\/span>&gt;<\/span>\n        <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>\n      <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>\n      <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">className<\/span>=<span class=\"hljs-string\">\"splitdiv\"<\/span> <span class=\"hljs-attr\">id<\/span>=<span class=\"hljs-string\">\"rightdiv\"<\/span>&gt;<\/span>\n        <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">id<\/span>=<span class=\"hljs-string\">\"itemdivcard\"<\/span>&gt;<\/span>\n          <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">h1<\/span>&gt;<\/span>Cropped image will apear here!<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">h1<\/span>&gt;<\/span>\n        <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>\n      <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>\n    <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>\n  );\n}\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>The current user interface doesn\u2019t look aesthetically pleasing, so you need to add some styling with CSS. You can update <code>src\/styles.css<\/code> file with the following content in this <a href=\"https:\/\/gist.github.com\/Olanetsoft\/856a6807dc3613b55c31587f3f6dd4a6\">GitHub Gist<\/a>.<\/p>\n<p>After adding the styling, your application should look like the image below.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/cloudinary-marketing-res.cloudinary.com\/image\/upload\/c_limit,w_2000\/f_auto\/q_auto\/media_jams\/s_8882902E1FCF1247CCFB5AA19BE3CC1EDB9A2A12CB2175D469BB7FCB6F6E7FD4_1648851183005_Screenshot+2022-04-01+at+23.12.35.png\" alt=\"How to Crop and Resize Image in the Browser\" loading=\"lazy\" class=\"c-transformed-asset\"  width=\"2000\" height=\"1124\"\/><\/p>\n<h2>Cropping with React-cropper<\/h2>\n<p>This section will import and setup <code>react-cropper<\/code>, the <a href=\"https:\/\/www.npmjs.com\/package\/react-cropper\">J<\/a><a href=\"https:\/\/www.npmjs.com\/package\/react-cropper\">avaScript<\/a> <a href=\"https:\/\/www.npmjs.com\/package\/react-cropper\">image cropper<\/a> you installed earlier, into the <code>src\/App.js<\/code> file.<\/p>\n<p>Import the react-cropper dependency<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript shcb-wrap-lines\"><span class=\"hljs-comment\">\/\/...<\/span>\n    \n<span class=\"hljs-keyword\">import<\/span> Cropper <span class=\"hljs-keyword\">from<\/span> <span class=\"hljs-string\">\"react-cropper\"<\/span>;\n<span class=\"hljs-keyword\">import<\/span> <span class=\"hljs-string\">\"cropperjs\/dist\/cropper.css\"<\/span>;\n    \n<span class=\"hljs-keyword\">export<\/span> <span class=\"hljs-keyword\">default<\/span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-title\">App<\/span>(<span class=\"hljs-params\"><\/span>) <\/span>{\n  <span class=\"hljs-keyword\">return<\/span> (\n    <span class=\"hljs-comment\">\/\/...<\/span>\n  );\n}\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><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>Declare state variables, <code>image<\/code> with a default value of an <code>image<\/code> url, <code>cropData<\/code> with a default of an empty string, and <code>cropper<\/code> with a default of <code>null<\/code>, respectively.<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript shcb-wrap-lines\"><span class=\"hljs-comment\">\/\/...<\/span>\n    \n<span class=\"hljs-keyword\">const<\/span> defaultSrc =<span class=\"hljs-string\">\"https:\/\/res.cloudinary.com\/olanetsoft\/image\/upload\/v1648679302\/uploadedFiles\/family.jpg\"<\/span>;\n    \n<span class=\"hljs-keyword\">export<\/span> <span class=\"hljs-keyword\">default<\/span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-title\">App<\/span>(<span class=\"hljs-params\"><\/span>) <\/span>{\n  <span class=\"hljs-keyword\">const<\/span> &#91;image, setImage] = useState(defaultSrc);\n  <span class=\"hljs-keyword\">const<\/span> &#91;cropData, setCropData] = useState(<span class=\"hljs-string\">\"\"<\/span>);\n  <span class=\"hljs-keyword\">const<\/span> &#91;cropper, setCropper] = useState(<span class=\"hljs-literal\">null<\/span>);\n    \n  <span class=\"hljs-keyword\">return<\/span> (\n    <span class=\"hljs-comment\">\/\/...<\/span>\n  );\n}\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><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>Render the Cropper Component<\/h2>\n<p>Use the <code>react-cropper<\/code> dependency installed and set the cropper state variable when the cropper dependency is initialized using the following code snippet.<\/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-comment\">\/\/...<\/span>\n    \n<span class=\"hljs-keyword\">export<\/span> <span class=\"hljs-keyword\">default<\/span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-title\">App<\/span>(<span class=\"hljs-params\"><\/span>) <\/span>{\n  <span class=\"hljs-comment\">\/\/...<\/span>\n    \n<span class=\"hljs-keyword\">return<\/span> (\n  <span class=\"xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span>&gt;<\/span>\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">className<\/span>=<span class=\"hljs-string\">\"splitdiv\"<\/span> <span class=\"hljs-attr\">id<\/span>=<span class=\"hljs-string\">\"leftdiv\"<\/span>&gt;<\/span>\n      \/\/...\n      <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">id<\/span>=<span class=\"hljs-string\">\"leftdivcard\"<\/span>&gt;<\/span>\n        \/\/...    \n        <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">Cropper<\/span>\n          <span class=\"hljs-attr\">className<\/span>=<span class=\"hljs-string\">\"cropper\"<\/span>\n          <span class=\"hljs-attr\">zoomTo<\/span>=<span class=\"hljs-string\">{0.5}<\/span>\n          <span class=\"hljs-attr\">initialAspectRatio<\/span>=<span class=\"hljs-string\">{1}<\/span>\n          <span class=\"hljs-attr\">src<\/span>=<span class=\"hljs-string\">{image}<\/span>\n          <span class=\"hljs-attr\">viewMode<\/span>=<span class=\"hljs-string\">{1}<\/span>\n          <span class=\"hljs-attr\">minCropBoxHeight<\/span>=<span class=\"hljs-string\">{10}<\/span>\n          <span class=\"hljs-attr\">minCropBoxWidth<\/span>=<span class=\"hljs-string\">{10}<\/span>\n          <span class=\"hljs-attr\">background<\/span>=<span class=\"hljs-string\">{false}<\/span>\n          <span class=\"hljs-attr\">responsive<\/span>=<span class=\"hljs-string\">{true}<\/span>\n          <span class=\"hljs-attr\">autoCropArea<\/span>=<span class=\"hljs-string\">{1}<\/span>\n          <span class=\"hljs-attr\">checkOrientation<\/span>=<span class=\"hljs-string\">{false}<\/span>\n          <span class=\"hljs-attr\">onInitialized<\/span>=<span class=\"hljs-string\">{(instance)<\/span> =&gt;<\/span> {\n            setCropper(instance);\n          }}\n          guides={true}\n        \/&gt;\n      <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>\n    <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>\n       \/\/...\n  <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span><\/span>\n);\n}\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<p>You should have something similar to what is shown below.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/cloudinary-marketing-res.cloudinary.com\/image\/upload\/c_limit,w_2000\/f_auto\/q_auto\/media_jams\/s_8882902E1FCF1247CCFB5AA19BE3CC1EDB9A2A12CB2175D469BB7FCB6F6E7FD4_1648852829737_Screenshot+2022-04-01+at+23.32.14.png\" alt=\"How to Crop and Resize Image in the Browser\" loading=\"lazy\" class=\"c-transformed-asset\"  width=\"2000\" height=\"1117\"\/><\/p>\n<p>Next, you will implement the image crop functionality using the code snippet below.<\/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\"><span class=\"hljs-comment\">\/\/...<\/span>\n    \n<span class=\"hljs-keyword\">export<\/span> <span class=\"hljs-keyword\">default<\/span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-title\">App<\/span>(<span class=\"hljs-params\"><\/span>) <\/span>{\n  <span class=\"hljs-comment\">\/\/...  <\/span>\n    \n<span class=\"hljs-keyword\">const<\/span> getCropData = <span class=\"hljs-function\"><span class=\"hljs-params\">()<\/span> =&gt;<\/span> {\n  <span class=\"hljs-keyword\">if<\/span> (<span class=\"hljs-keyword\">typeof<\/span> cropper !== <span class=\"hljs-string\">\"undefined\"<\/span>) {\n    setCropData(cropper.getCroppedCanvas().toDataURL());\n  }\n};\n    \n<span class=\"hljs-keyword\">return<\/span> (\n  <span class=\"xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span>&gt;<\/span>\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">className<\/span>=<span class=\"hljs-string\">\"splitdiv\"<\/span> <span class=\"hljs-attr\">id<\/span>=<span class=\"hljs-string\">\"leftdiv\"<\/span>&gt;<\/span>\n      \/\/...\n      <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">id<\/span>=<span class=\"hljs-string\">\"leftdivcard\"<\/span>&gt;<\/span>\n        \/\/...\n          <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">Cropper<\/span>\n            \/\/<span class=\"hljs-attr\">...<\/span>\n            <span class=\"hljs-attr\">onInitialized<\/span>=<span class=\"hljs-string\">{(instance)<\/span> =&gt;<\/span> {\n              setCropper(instance);\n            }}\n            guides={true}\n          \/&gt;\n      <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>\n    <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">className<\/span>=<span class=\"hljs-string\">\"splitdiv\"<\/span> <span class=\"hljs-attr\">id<\/span>=<span class=\"hljs-string\">\"rightdiv\"<\/span>&gt;<\/span>\n      <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">id<\/span>=<span class=\"hljs-string\">\"itemdivcard\"<\/span>&gt;<\/span>\n        {cropData ? (\n          <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">img<\/span> <span class=\"hljs-attr\">style<\/span>=<span class=\"hljs-string\">{{<\/span> <span class=\"hljs-attr\">height:<\/span> \"<span class=\"hljs-attr\">50<\/span>%\" }} <span class=\"hljs-attr\">src<\/span>=<span class=\"hljs-string\">{cropData}<\/span> <span class=\"hljs-attr\">alt<\/span>=<span class=\"hljs-string\">\"cropped\"<\/span> \/&gt;<\/span>\n        ) : (\n          <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">h1<\/span>&gt;<\/span>Cropped image will apear here!<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">h1<\/span>&gt;<\/span>\n        )}\n      <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>\n    <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>\n  <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span><\/span>\n);\n}\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>In the code snippet above has,<\/p>\n<ul>\n<li>Created a function <code>*getCropData*<\/code> which validates that the <code>cropper<\/code> state variable is not undefined, and then set the cropper using <code>*setCropData*<\/code> to the cropped canvas<\/li>\n<li>Passed the <code>*getCropData*<\/code> to the <code>onClick<\/code> event of the Crop Image button<\/li>\n<li>Validate the <code>cropData<\/code> is not empty, and then we render the cropped data image as shown below.<\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"https:\/\/cloudinary-marketing-res.cloudinary.com\/image\/upload\/c_limit,w_2000\/f_auto\/q_auto\/media_jams\/s_8882902E1FCF1247CCFB5AA19BE3CC1EDB9A2A12CB2175D469BB7FCB6F6E7FD4_1648853638748_Screenshot+2022-04-01+at+23.48.37.png\" alt=\"\" loading=\"lazy\" class=\"c-transformed-asset\"  width=\"2000\" height=\"1118\"\/><\/p>\n<h2>Replace Default Image with Uploaded Image<\/h2>\n<p>A default image url was passed to the <code>image<\/code> state variable in the previous step. You can explore the upload image functionality by allowing users to upload their images.<\/p>\n<p>You can achieve this action by using the code snippet below.<\/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\"><span class=\"hljs-comment\">\/\/...<\/span>\n    \n<span class=\"hljs-keyword\">export<\/span> <span class=\"hljs-keyword\">default<\/span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-title\">App<\/span>(<span class=\"hljs-params\"><\/span>) <\/span>{\n  <span class=\"hljs-comment\">\/\/... <\/span>\n    \n<span class=\"hljs-keyword\">const<\/span> onChange = <span class=\"hljs-function\">(<span class=\"hljs-params\">e<\/span>) =&gt;<\/span> {\n  e.preventDefault();\n  <span class=\"hljs-keyword\">let<\/span> files;\n  <span class=\"hljs-keyword\">if<\/span> (e.dataTransfer) {\n    files = e.dataTransfer.files;\n  } <span class=\"hljs-keyword\">else<\/span> <span class=\"hljs-keyword\">if<\/span> (e.target) {\n    files = e.target.files;\n  }\n  <span class=\"hljs-keyword\">const<\/span> reader = <span class=\"hljs-keyword\">new<\/span> FileReader();\n  reader.onload = <span class=\"hljs-function\"><span class=\"hljs-params\">()<\/span> =&gt;<\/span> {\n    setImage(reader.result);\n  };\n  reader.readAsDataURL(files&#91;<span class=\"hljs-number\">0<\/span>]);\n};\n    \n<span class=\"hljs-keyword\">return<\/span> (\n  <span class=\"xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span>&gt;<\/span>\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">className<\/span>=<span class=\"hljs-string\">\"splitdiv\"<\/span> <span class=\"hljs-attr\">id<\/span>=<span class=\"hljs-string\">\"leftdiv\"<\/span>&gt;<\/span>\n            \/\/...\n      <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">id<\/span>=<span class=\"hljs-string\">\"leftdivcard\"<\/span>&gt;<\/span>\n        <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">input<\/span> <span class=\"hljs-attr\">type<\/span>=<span class=\"hljs-string\">\"file\"<\/span> <span class=\"hljs-attr\">onChange<\/span>=<span class=\"hljs-string\">{onChange}<\/span> \/&gt;<\/span>\n          \/\/...\n      <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>\n    <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>\n      \/\/...\n  <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span><\/span>\n);\n}\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>In the code snippet above, you created a function <code>onChange<\/code> triggered when the input tag event changed and reads the file uploaded as data URL.<\/p>\n<p>You should have something similar to what is shown below after testing.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/cloudinary-marketing-res.cloudinary.com\/image\/upload\/c_limit,w_2000\/f_auto\/q_auto\/media_jams\/s_8882902E1FCF1247CCFB5AA19BE3CC1EDB9A2A12CB2175D469BB7FCB6F6E7FD4_1648854487498_Screenshot+2022-04-02+at+00.01.49.png\" alt=\"How to Crop and Resize Image in the Browser\" loading=\"lazy\" class=\"c-transformed-asset\"  width=\"2000\" height=\"1117\"\/><\/p>\n<h2>Reset to the Default Image<\/h2>\n<p>Next, you will implement the <code>Use Default Image<\/code> button functionality by creating a function that sets the <code>image<\/code> state variable using the code snippet below.<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript shcb-wrap-lines\"><span class=\"hljs-comment\">\/\/...<\/span>\n    \n<span class=\"hljs-keyword\">export<\/span> <span class=\"hljs-keyword\">default<\/span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-title\">App<\/span>(<span class=\"hljs-params\"><\/span>) <\/span>{\n  <span class=\"hljs-comment\">\/\/...<\/span>\n\n<span class=\"hljs-keyword\">const<\/span> reset = <span class=\"hljs-function\"><span class=\"hljs-params\">()<\/span> =&gt;<\/span> {\n  etImage(defaultSrc);\n};\n\n<span class=\"hljs-keyword\">return<\/span> (\n  <span class=\"xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span>&gt;<\/span>\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">className<\/span>=<span class=\"hljs-string\">\"splitdiv\"<\/span> <span class=\"hljs-attr\">id<\/span>=<span class=\"hljs-string\">\"leftdiv\"<\/span>&gt;<\/span>\n      \/\/...\n      <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">id<\/span>=<span class=\"hljs-string\">\"leftdivcard\"<\/span>&gt;<\/span>\n        \/\/...\n        <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">button<\/span> <span class=\"hljs-attr\">type<\/span>=<span class=\"hljs-string\">\"button\"<\/span> <span class=\"hljs-attr\">id<\/span>=<span class=\"hljs-string\">\"leftbutton\"<\/span> <span class=\"hljs-attr\">onClick<\/span>=<span class=\"hljs-string\">{reset}<\/span>&gt;<\/span>\n          Use Default Image\n        <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">button<\/span>&gt;<\/span>\n        \/\/...\n      <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>\n    <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>\n     \/\/...\n  <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span><\/span>\n);\n}\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><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>After testing your application, you should have something similar to what is shown below.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/cloudinary-marketing-res.cloudinary.com\/image\/upload\/c_limit,w_2000\/f_auto\/q_auto\/media_jams\/s_8882902E1FCF1247CCFB5AA19BE3CC1EDB9A2A12CB2175D469BB7FCB6F6E7FD4_1648854972562_Screenshot+2022-04-02+at+00.15.47.png\" alt=\"\" loading=\"lazy\" class=\"c-transformed-asset\"  width=\"2000\" height=\"1120\"\/><\/p>\n<h2>Conclusion<\/h2>\n<p>This article explained how to crop and resize image in the browser<\/p>\n<h2>Resources<\/h2>\n<ul>\n<li>\n<a href=\"https:\/\/www.npmjs.com\/package\/react-cropper\">React Cropper<\/a>\n<\/li>\n<li>\n<a href=\"https:\/\/reactjs.org\/\">React.js<\/a>\n<\/li>\n<\/ul>\n<\/div>","protected":false},"excerpt":{"rendered":"","protected":false},"author":41,"featured_media":28059,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_cloudinary_featured_overwrite":false,"footnotes":""},"categories":[1],"tags":[134,370,177,246,377,371],"class_list":["post-28058","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-guest-post","tag-image","tag-javascript","tag-react","tag-resizing","tag-under-review"],"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>How to Crop and Resize Image in the Browser<\/title>\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\/guest_post\/how-to-crop-and-resize-image-in-the-browser-with-react\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Crop and Resize Image in the Browser\" \/>\n<meta property=\"og:url\" content=\"https:\/\/cloudinary.com\/blog\/guest_post\/how-to-crop-and-resize-image-in-the-browser-with-react\/\" \/>\n<meta property=\"og:site_name\" content=\"Cloudinary Blog\" \/>\n<meta property=\"article:published_time\" content=\"2022-04-25T06:34:15+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-02-16T21:09:29+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/v1681925528\/Web_Assets\/blog\/4031c99a7c450aafa24670d1a597cfdc063d380a-1600x893-1_2805941747\/4031c99a7c450aafa24670d1a597cfdc063d380a-1600x893-1_2805941747-png?_i=AA\" \/>\n\t<meta property=\"og:image:width\" content=\"1600\" \/>\n\t<meta property=\"og:image:height\" content=\"893\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\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\/guest_post\/how-to-crop-and-resize-image-in-the-browser-with-react\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/guest_post\/how-to-crop-and-resize-image-in-the-browser-with-react\/\"},\"author\":{\"name\":\"\",\"@id\":\"\"},\"headline\":\"How to Crop and Resize Image in the Browser\",\"datePublished\":\"2022-04-25T06:34:15+00:00\",\"dateModified\":\"2025-02-16T21:09:29+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/guest_post\/how-to-crop-and-resize-image-in-the-browser-with-react\/\"},\"wordCount\":9,\"publisher\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/guest_post\/how-to-crop-and-resize-image-in-the-browser-with-react\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1681925528\/Web_Assets\/blog\/4031c99a7c450aafa24670d1a597cfdc063d380a-1600x893-1_2805941747\/4031c99a7c450aafa24670d1a597cfdc063d380a-1600x893-1_2805941747.png?_i=AA\",\"keywords\":[\"Guest Post\",\"Image\",\"Javascript\",\"React\",\"Resizing\",\"Under Review\"],\"inLanguage\":\"en-US\",\"copyrightYear\":\"2022\",\"copyrightHolder\":{\"@id\":\"https:\/\/cloudinary.com\/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/cloudinary.com\/blog\/guest_post\/how-to-crop-and-resize-image-in-the-browser-with-react\/\",\"url\":\"https:\/\/cloudinary.com\/blog\/guest_post\/how-to-crop-and-resize-image-in-the-browser-with-react\/\",\"name\":\"How to Crop and Resize Image in the Browser\",\"isPartOf\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/guest_post\/how-to-crop-and-resize-image-in-the-browser-with-react\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/guest_post\/how-to-crop-and-resize-image-in-the-browser-with-react\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1681925528\/Web_Assets\/blog\/4031c99a7c450aafa24670d1a597cfdc063d380a-1600x893-1_2805941747\/4031c99a7c450aafa24670d1a597cfdc063d380a-1600x893-1_2805941747.png?_i=AA\",\"datePublished\":\"2022-04-25T06:34:15+00:00\",\"dateModified\":\"2025-02-16T21:09:29+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/guest_post\/how-to-crop-and-resize-image-in-the-browser-with-react\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/cloudinary.com\/blog\/guest_post\/how-to-crop-and-resize-image-in-the-browser-with-react\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cloudinary.com\/blog\/guest_post\/how-to-crop-and-resize-image-in-the-browser-with-react\/#primaryimage\",\"url\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1681925528\/Web_Assets\/blog\/4031c99a7c450aafa24670d1a597cfdc063d380a-1600x893-1_2805941747\/4031c99a7c450aafa24670d1a597cfdc063d380a-1600x893-1_2805941747.png?_i=AA\",\"contentUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1681925528\/Web_Assets\/blog\/4031c99a7c450aafa24670d1a597cfdc063d380a-1600x893-1_2805941747\/4031c99a7c450aafa24670d1a597cfdc063d380a-1600x893-1_2805941747.png?_i=AA\",\"width\":1600,\"height\":893},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/cloudinary.com\/blog\/guest_post\/how-to-crop-and-resize-image-in-the-browser-with-react\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/cloudinary.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Crop and Resize Image in the Browser\"}]},{\"@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":"How to Crop and Resize Image in the Browser","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\/guest_post\/how-to-crop-and-resize-image-in-the-browser-with-react\/","og_locale":"en_US","og_type":"article","og_title":"How to Crop and Resize Image in the Browser","og_url":"https:\/\/cloudinary.com\/blog\/guest_post\/how-to-crop-and-resize-image-in-the-browser-with-react\/","og_site_name":"Cloudinary Blog","article_published_time":"2022-04-25T06:34:15+00:00","article_modified_time":"2025-02-16T21:09:29+00:00","og_image":[{"width":1600,"height":893,"url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/v1681925528\/Web_Assets\/blog\/4031c99a7c450aafa24670d1a597cfdc063d380a-1600x893-1_2805941747\/4031c99a7c450aafa24670d1a597cfdc063d380a-1600x893-1_2805941747-png?_i=AA","type":"image\/png"}],"twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"NewsArticle","@id":"https:\/\/cloudinary.com\/blog\/guest_post\/how-to-crop-and-resize-image-in-the-browser-with-react\/#article","isPartOf":{"@id":"https:\/\/cloudinary.com\/blog\/guest_post\/how-to-crop-and-resize-image-in-the-browser-with-react\/"},"author":{"name":"","@id":""},"headline":"How to Crop and Resize Image in the Browser","datePublished":"2022-04-25T06:34:15+00:00","dateModified":"2025-02-16T21:09:29+00:00","mainEntityOfPage":{"@id":"https:\/\/cloudinary.com\/blog\/guest_post\/how-to-crop-and-resize-image-in-the-browser-with-react\/"},"wordCount":9,"publisher":{"@id":"https:\/\/cloudinary.com\/blog\/#organization"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/guest_post\/how-to-crop-and-resize-image-in-the-browser-with-react\/#primaryimage"},"thumbnailUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1681925528\/Web_Assets\/blog\/4031c99a7c450aafa24670d1a597cfdc063d380a-1600x893-1_2805941747\/4031c99a7c450aafa24670d1a597cfdc063d380a-1600x893-1_2805941747.png?_i=AA","keywords":["Guest Post","Image","Javascript","React","Resizing","Under Review"],"inLanguage":"en-US","copyrightYear":"2022","copyrightHolder":{"@id":"https:\/\/cloudinary.com\/#organization"}},{"@type":"WebPage","@id":"https:\/\/cloudinary.com\/blog\/guest_post\/how-to-crop-and-resize-image-in-the-browser-with-react\/","url":"https:\/\/cloudinary.com\/blog\/guest_post\/how-to-crop-and-resize-image-in-the-browser-with-react\/","name":"How to Crop and Resize Image in the Browser","isPartOf":{"@id":"https:\/\/cloudinary.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/cloudinary.com\/blog\/guest_post\/how-to-crop-and-resize-image-in-the-browser-with-react\/#primaryimage"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/guest_post\/how-to-crop-and-resize-image-in-the-browser-with-react\/#primaryimage"},"thumbnailUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1681925528\/Web_Assets\/blog\/4031c99a7c450aafa24670d1a597cfdc063d380a-1600x893-1_2805941747\/4031c99a7c450aafa24670d1a597cfdc063d380a-1600x893-1_2805941747.png?_i=AA","datePublished":"2022-04-25T06:34:15+00:00","dateModified":"2025-02-16T21:09:29+00:00","breadcrumb":{"@id":"https:\/\/cloudinary.com\/blog\/guest_post\/how-to-crop-and-resize-image-in-the-browser-with-react\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/cloudinary.com\/blog\/guest_post\/how-to-crop-and-resize-image-in-the-browser-with-react\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudinary.com\/blog\/guest_post\/how-to-crop-and-resize-image-in-the-browser-with-react\/#primaryimage","url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1681925528\/Web_Assets\/blog\/4031c99a7c450aafa24670d1a597cfdc063d380a-1600x893-1_2805941747\/4031c99a7c450aafa24670d1a597cfdc063d380a-1600x893-1_2805941747.png?_i=AA","contentUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1681925528\/Web_Assets\/blog\/4031c99a7c450aafa24670d1a597cfdc063d380a-1600x893-1_2805941747\/4031c99a7c450aafa24670d1a597cfdc063d380a-1600x893-1_2805941747.png?_i=AA","width":1600,"height":893},{"@type":"BreadcrumbList","@id":"https:\/\/cloudinary.com\/blog\/guest_post\/how-to-crop-and-resize-image-in-the-browser-with-react\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/cloudinary.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Crop and Resize Image in the Browser"}]},{"@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\/v1681925528\/Web_Assets\/blog\/4031c99a7c450aafa24670d1a597cfdc063d380a-1600x893-1_2805941747\/4031c99a7c450aafa24670d1a597cfdc063d380a-1600x893-1_2805941747.png?_i=AA","_links":{"self":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/28058","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=28058"}],"version-history":[{"count":1,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/28058\/revisions"}],"predecessor-version":[{"id":36863,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/28058\/revisions\/36863"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/media\/28059"}],"wp:attachment":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/media?parent=28058"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/categories?post=28058"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/tags?post=28058"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}