{"id":6026,"date":"2024-01-11T16:40:00","date_gmt":"2024-01-11T16:40:00","guid":{"rendered":"https:\/\/codehim.com\/?p=6026"},"modified":"2024-01-22T14:43:40","modified_gmt":"2024-01-22T09:43:40","slug":"javascript-crop-image-and-save","status":"publish","type":"post","link":"https:\/\/codehim.com\/vanilla-javascript\/javascript-crop-image-and-save\/","title":{"rendered":"JavaScript Crop Image Before Upload 100% Working"},"content":{"rendered":"<p>This JavaScript code snippet is based on a simple idea to crop an image and save\/download them instantly. It uses the JavaScript image Cropper library (cropper.js) to perform image cropping.<\/p>\n<p>Basically, this code snippet just focuses on just image cropping and lets users download it. But you can modify the Cropper JS configurations to <a href=\"https:\/\/codehim.com\/text-input\/jquery-multiple-image-upload-with-preview-and-delete\/\" target=\"_blank\" rel=\"noopener\">upload the image<\/a> to the server. Similarly, you can crop images programmatically or create a functionality to allows users to crop images before upload. To do so, read the <a href=\"https:\/\/github.com\/fengyuanchen\/cropperjs\/blob\/main\/README.md\" target=\"_blank\" rel=\"noopener\">Cropper JS docs<\/a>.<\/p>\n<h2>How to Create JavaScript Crop Image and Save Functionality<\/h2>\n<p>1. In order to create image crop and save functionality, you need to get started with <a href=\"https:\/\/fengyuanchen.github.io\/cropperjs\/\" target=\"_blank\" rel=\"noopener\">Cropper JS<\/a>. So, load the Normalize CSS, Cropper CSS, and Cropper JS file into the head tag of your HTML document.<\/p>\n<pre class=\"prettyprint lienums lang-html\">&lt;!-- Normalize CSS --&gt;\r\n&lt;link rel=\"stylesheet\" href=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/normalize\/5.0.0\/normalize.min.css\"&gt;\r\n&lt;!-- Cropper CSS --&gt;\r\n&lt;link rel='stylesheet' href='https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/cropper\/2.3.4\/cropper.min.css'&gt;\r\n&lt;!-- Cropper JS --&gt;\r\n&lt;script src='https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/cropperjs\/0.8.1\/cropper.min.js'&gt;&lt;\/script&gt;\r\n<\/pre>\n<p>2. After that, create a file input with an id <code>\"file-input\"<\/code> that will allow users to upload images that they want to crop. Then create an img element with a class name &#8220;cropped&#8221; and keep its src attribute empty. Similarly, create a button element with a class name &#8220;save&#8221; and a link with the class name &#8220;download&#8221;. Wrap all these elements into the main tag and define its class name &#8220;page&#8221;. The complete HTML structure for a basic image crop is as follows:<\/p>\n<pre class=\"prettyprint lang-html\">&lt;main class=\"page\"&gt;\r\n\t&lt;h2&gt;Upload ,Crop and save.&lt;\/h2&gt;\r\n\t&lt;!-- input file --&gt;\r\n\t&lt;div class=\"box\"&gt;\r\n\t\t&lt;input type=\"file\" id=\"file-input\"&gt;\r\n\t&lt;\/div&gt;\r\n\t&lt;!-- leftbox --&gt;\r\n\t&lt;div class=\"box-2\"&gt;\r\n\t\t&lt;div class=\"result\"&gt;&lt;\/div&gt;\r\n\t&lt;\/div&gt;\r\n\t&lt;!--rightbox--&gt;\r\n\t&lt;div class=\"box-2 img-result hide\"&gt;\r\n\t\t&lt;!-- result of crop --&gt;\r\n\t\t&lt;img class=\"cropped\" src=\"\" alt=\"\"&gt;\r\n\t&lt;\/div&gt;\r\n\t&lt;!-- input file --&gt;\r\n\t&lt;div class=\"box\"&gt;\r\n\t\t&lt;div class=\"options hide\"&gt;\r\n\t\t\t&lt;label&gt; Width&lt;\/label&gt;\r\n\t\t\t&lt;input type=\"number\" class=\"img-w\" value=\"300\" min=\"100\" max=\"1200\" \/&gt;\r\n\t\t&lt;\/div&gt;\r\n\t\t&lt;!-- save btn --&gt;\r\n\t\t&lt;button class=\"btn save hide\"&gt;Save&lt;\/button&gt;\r\n\t\t&lt;!-- download btn --&gt;\r\n\t\t&lt;a href=\"\" class=\"btn download hide\"&gt;Download&lt;\/a&gt;\r\n\t&lt;\/div&gt;\r\n &lt;\/main&gt;\r\n<\/pre>\n<p>3. After creating the HTML, use the following CSS style for the image crop interface. You can also use your own CSS styles or change in order to customize it according to your needs.<\/p>\n<pre class=\"prettyprint linenums lang-css\">.page {\r\n\tmargin: 1em auto;\r\n\tmax-width: 768px;\r\n\tdisplay: flex;\r\n\talign-items: flex-start;\r\n\tflex-wrap: wrap;\r\n\theight: 100%;\r\n}\r\n\r\n.box {\r\n\tpadding: 0.5em;\r\n\twidth: 100%;\r\n\tmargin: 0.5em;\r\n}\r\n\r\n.box-2 {\r\n\tpadding: 0.5em;\r\n\twidth: calc(100%\/2 - 1em);\r\n}\r\n\r\n.options label,\r\n.options input {\r\n\twidth: 4em;\r\n\tpadding: 0.5em 1em;\r\n}\r\n\r\n.btn {\r\n\tbackground: white;\r\n\tcolor: black;\r\n\tborder: 1px solid black;\r\n\tpadding: 0.5em 1em;\r\n\ttext-decoration: none;\r\n\tmargin: 0.8em 0.3em;\r\n\tdisplay: inline-block;\r\n\tcursor: pointer;\r\n}\r\n\r\n.hide {\r\n\tdisplay: none;\r\n}\r\n\r\nimg {\r\n\tmax-width: 100%;\r\n}\r\n<\/pre>\n<p>4. Finally, initialize the cropper JS with the following configurations. You can add the following JS code between the &lt;script&gt; tag or create a separate JS file and include it in your project.<\/p>\n<pre class=\"prettyprint linenums lang-js\">\/\/ vars\r\nlet result = document.querySelector('.result'),\r\nimg_result = document.querySelector('.img-result'),\r\nimg_w = document.querySelector('.img-w'),\r\nimg_h = document.querySelector('.img-h'),\r\noptions = document.querySelector('.options'),\r\nsave = document.querySelector('.save'),\r\ncropped = document.querySelector('.cropped'),\r\ndwn = document.querySelector('.download'),\r\nupload = document.querySelector('#file-input'),\r\ncropper = '';\r\n\r\n\/\/ on change show image with crop options\r\nupload.addEventListener('change', e =&gt; {\r\n  if (e.target.files.length) {\r\n    \/\/ start file reader\r\n    const reader = new FileReader();\r\n    reader.onload = e =&gt; {\r\n      if (e.target.result) {\r\n        \/\/ create new image\r\n        let img = document.createElement('img');\r\n        img.id = 'image';\r\n        img.src = e.target.result;\r\n        \/\/ clean result before\r\n        result.innerHTML = '';\r\n        \/\/ append new image\r\n        result.appendChild(img);\r\n        \/\/ show save btn and options\r\n        save.classList.remove('hide');\r\n        options.classList.remove('hide');\r\n        \/\/ init cropper\r\n        cropper = new Cropper(img);\r\n      }\r\n    };\r\n    reader.readAsDataURL(e.target.files[0]);\r\n  }\r\n});\r\n\r\n\/\/ save on click\r\nsave.addEventListener('click', e =&gt; {\r\n  e.preventDefault();\r\n  \/\/ get result to data uri\r\n  let imgSrc = cropper.getCroppedCanvas({\r\n    width: img_w.value \/\/ input value\r\n  }).toDataURL();\r\n  \/\/ remove hide class of img\r\n  cropped.classList.remove('hide');\r\n  img_result.classList.remove('hide');\r\n  \/\/ show image cropped\r\n  cropped.src = imgSrc;\r\n  dwn.classList.remove('hide');\r\n  dwn.download = 'imagename.png';\r\n  dwn.setAttribute('href', imgSrc);\r\n});\r\n<\/pre>\n<p>That&#8217;s all! Hopefully, you have successfully created an image crop functionality in your project. If you have any questions or facing any issues, feel free to comment below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This JavaScript code snippet is based on a simple idea to crop an image and save\/download them instantly. It uses&#8230;<\/p>\n","protected":false},"author":1,"featured_media":6029,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[116],"tags":[218],"class_list":["post-6026","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-vanilla-javascript","tag-image-cropper"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>JavaScript Crop Image Before Upload 100% Working &#8212; CodeHim<\/title>\n<meta name=\"description\" content=\"Here is a lightweight JavaScript code snippet to crop image and save it. You can view demo and download code for image cropper JS.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/codehim.com\/vanilla-javascript\/javascript-crop-image-and-save\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JavaScript Crop Image Before Upload 100% Working &#8212; CodeHim\" \/>\n<meta property=\"og:description\" content=\"Here is a lightweight JavaScript code snippet to crop image and save it. You can view demo and download code for image cropper JS.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/codehim.com\/vanilla-javascript\/javascript-crop-image-and-save\/\" \/>\n<meta property=\"og:site_name\" content=\"CodeHim\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/codehimofficial\" \/>\n<meta property=\"article:published_time\" content=\"2024-01-11T16:40:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-01-22T09:43:40+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/codehim.com\/wp-content\/uploads\/2022\/02\/javascript-crop-image-before-upload.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"961\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Asif Mughal\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@CodeHimOfficial\" \/>\n<meta name=\"twitter:site\" content=\"@CodeHimOfficial\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Asif Mughal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/codehim.com\/vanilla-javascript\/javascript-crop-image-and-save\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/codehim.com\/vanilla-javascript\/javascript-crop-image-and-save\/\"},\"author\":{\"name\":\"Asif Mughal\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed\"},\"headline\":\"JavaScript Crop Image Before Upload 100% Working\",\"datePublished\":\"2024-01-11T16:40:00+00:00\",\"dateModified\":\"2024-01-22T09:43:40+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/codehim.com\/vanilla-javascript\/javascript-crop-image-and-save\/\"},\"wordCount\":316,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/codehim.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/codehim.com\/vanilla-javascript\/javascript-crop-image-and-save\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/codehim.com\/wp-content\/uploads\/2022\/02\/javascript-crop-image-before-upload.png\",\"keywords\":[\"Image Cropper\"],\"articleSection\":[\"Vanilla JavaScript\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/codehim.com\/vanilla-javascript\/javascript-crop-image-and-save\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/codehim.com\/vanilla-javascript\/javascript-crop-image-and-save\/\",\"url\":\"https:\/\/codehim.com\/vanilla-javascript\/javascript-crop-image-and-save\/\",\"name\":\"JavaScript Crop Image Before Upload 100% Working &#8212; CodeHim\",\"isPartOf\":{\"@id\":\"https:\/\/codehim.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/codehim.com\/vanilla-javascript\/javascript-crop-image-and-save\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/codehim.com\/vanilla-javascript\/javascript-crop-image-and-save\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/codehim.com\/wp-content\/uploads\/2022\/02\/javascript-crop-image-before-upload.png\",\"datePublished\":\"2024-01-11T16:40:00+00:00\",\"dateModified\":\"2024-01-22T09:43:40+00:00\",\"description\":\"Here is a lightweight JavaScript code snippet to crop image and save it. You can view demo and download code for image cropper JS.\",\"breadcrumb\":{\"@id\":\"https:\/\/codehim.com\/vanilla-javascript\/javascript-crop-image-and-save\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/codehim.com\/vanilla-javascript\/javascript-crop-image-and-save\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codehim.com\/vanilla-javascript\/javascript-crop-image-and-save\/#primaryimage\",\"url\":\"https:\/\/codehim.com\/wp-content\/uploads\/2022\/02\/javascript-crop-image-before-upload.png\",\"contentUrl\":\"https:\/\/codehim.com\/wp-content\/uploads\/2022\/02\/javascript-crop-image-before-upload.png\",\"width\":1280,\"height\":961,\"caption\":\"JavaScript Crop Image and Save\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/codehim.com\/vanilla-javascript\/javascript-crop-image-and-save\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/codehim.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Vanilla JavaScript\",\"item\":\"https:\/\/codehim.com\/category\/vanilla-javascript\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"JavaScript Crop Image Before Upload 100% Working\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/codehim.com\/#website\",\"url\":\"https:\/\/codehim.com\/\",\"name\":\"CodeHim\",\"description\":\"Web Design Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/codehim.com\/#organization\"},\"alternateName\":\"Web Design Codes\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/codehim.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/codehim.com\/#organization\",\"name\":\"CodeHim - Web Design Code & Scripts\",\"url\":\"https:\/\/codehim.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/logo\/image\/\",\"url\":\"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg\",\"contentUrl\":\"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg\",\"width\":280,\"height\":280,\"caption\":\"CodeHim - Web Design Code & Scripts\"},\"image\":{\"@id\":\"https:\/\/codehim.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/codehimofficial\",\"https:\/\/x.com\/CodeHimOfficial\",\"https:\/\/www.instagram.com\/codehim\/\",\"https:\/\/www.linkedin.com\/company\/codehim\",\"https:\/\/co.pinterest.com\/codehim\/\",\"https:\/\/www.youtube.com\/@codehim\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed\",\"name\":\"Asif Mughal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g\",\"caption\":\"Asif Mughal\"},\"description\":\"I code and create web elements for amazing people around the world. I like work with new people. New people new Experiences. I truly enjoy what I'm doing, which makes me more passionate about web development and coding. I am always ready to do challenging tasks whether it is about creating a custom CMS from scratch or customizing an existing system.\",\"sameAs\":[\"https:\/\/codehim.com\"],\"url\":\"https:\/\/codehim.com\/author\/asif-mughal\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"JavaScript Crop Image Before Upload 100% Working &#8212; CodeHim","description":"Here is a lightweight JavaScript code snippet to crop image and save it. You can view demo and download code for image cropper JS.","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:\/\/codehim.com\/vanilla-javascript\/javascript-crop-image-and-save\/","og_locale":"en_US","og_type":"article","og_title":"JavaScript Crop Image Before Upload 100% Working &#8212; CodeHim","og_description":"Here is a lightweight JavaScript code snippet to crop image and save it. You can view demo and download code for image cropper JS.","og_url":"https:\/\/codehim.com\/vanilla-javascript\/javascript-crop-image-and-save\/","og_site_name":"CodeHim","article_publisher":"https:\/\/www.facebook.com\/codehimofficial","article_published_time":"2024-01-11T16:40:00+00:00","article_modified_time":"2024-01-22T09:43:40+00:00","og_image":[{"width":1280,"height":961,"url":"https:\/\/codehim.com\/wp-content\/uploads\/2022\/02\/javascript-crop-image-before-upload.png","type":"image\/png"}],"author":"Asif Mughal","twitter_card":"summary_large_image","twitter_creator":"@CodeHimOfficial","twitter_site":"@CodeHimOfficial","twitter_misc":{"Written by":"Asif Mughal","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/codehim.com\/vanilla-javascript\/javascript-crop-image-and-save\/#article","isPartOf":{"@id":"https:\/\/codehim.com\/vanilla-javascript\/javascript-crop-image-and-save\/"},"author":{"name":"Asif Mughal","@id":"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed"},"headline":"JavaScript Crop Image Before Upload 100% Working","datePublished":"2024-01-11T16:40:00+00:00","dateModified":"2024-01-22T09:43:40+00:00","mainEntityOfPage":{"@id":"https:\/\/codehim.com\/vanilla-javascript\/javascript-crop-image-and-save\/"},"wordCount":316,"commentCount":0,"publisher":{"@id":"https:\/\/codehim.com\/#organization"},"image":{"@id":"https:\/\/codehim.com\/vanilla-javascript\/javascript-crop-image-and-save\/#primaryimage"},"thumbnailUrl":"https:\/\/codehim.com\/wp-content\/uploads\/2022\/02\/javascript-crop-image-before-upload.png","keywords":["Image Cropper"],"articleSection":["Vanilla JavaScript"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/codehim.com\/vanilla-javascript\/javascript-crop-image-and-save\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/codehim.com\/vanilla-javascript\/javascript-crop-image-and-save\/","url":"https:\/\/codehim.com\/vanilla-javascript\/javascript-crop-image-and-save\/","name":"JavaScript Crop Image Before Upload 100% Working &#8212; CodeHim","isPartOf":{"@id":"https:\/\/codehim.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/codehim.com\/vanilla-javascript\/javascript-crop-image-and-save\/#primaryimage"},"image":{"@id":"https:\/\/codehim.com\/vanilla-javascript\/javascript-crop-image-and-save\/#primaryimage"},"thumbnailUrl":"https:\/\/codehim.com\/wp-content\/uploads\/2022\/02\/javascript-crop-image-before-upload.png","datePublished":"2024-01-11T16:40:00+00:00","dateModified":"2024-01-22T09:43:40+00:00","description":"Here is a lightweight JavaScript code snippet to crop image and save it. You can view demo and download code for image cropper JS.","breadcrumb":{"@id":"https:\/\/codehim.com\/vanilla-javascript\/javascript-crop-image-and-save\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/codehim.com\/vanilla-javascript\/javascript-crop-image-and-save\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codehim.com\/vanilla-javascript\/javascript-crop-image-and-save\/#primaryimage","url":"https:\/\/codehim.com\/wp-content\/uploads\/2022\/02\/javascript-crop-image-before-upload.png","contentUrl":"https:\/\/codehim.com\/wp-content\/uploads\/2022\/02\/javascript-crop-image-before-upload.png","width":1280,"height":961,"caption":"JavaScript Crop Image and Save"},{"@type":"BreadcrumbList","@id":"https:\/\/codehim.com\/vanilla-javascript\/javascript-crop-image-and-save\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/codehim.com\/"},{"@type":"ListItem","position":2,"name":"Vanilla JavaScript","item":"https:\/\/codehim.com\/category\/vanilla-javascript\/"},{"@type":"ListItem","position":3,"name":"JavaScript Crop Image Before Upload 100% Working"}]},{"@type":"WebSite","@id":"https:\/\/codehim.com\/#website","url":"https:\/\/codehim.com\/","name":"CodeHim","description":"Web Design Code Snippets","publisher":{"@id":"https:\/\/codehim.com\/#organization"},"alternateName":"Web Design Codes","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/codehim.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/codehim.com\/#organization","name":"CodeHim - Web Design Code & Scripts","url":"https:\/\/codehim.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codehim.com\/#\/schema\/logo\/image\/","url":"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg","contentUrl":"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg","width":280,"height":280,"caption":"CodeHim - Web Design Code & Scripts"},"image":{"@id":"https:\/\/codehim.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/codehimofficial","https:\/\/x.com\/CodeHimOfficial","https:\/\/www.instagram.com\/codehim\/","https:\/\/www.linkedin.com\/company\/codehim","https:\/\/co.pinterest.com\/codehim\/","https:\/\/www.youtube.com\/@codehim"]},{"@type":"Person","@id":"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed","name":"Asif Mughal","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codehim.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g","caption":"Asif Mughal"},"description":"I code and create web elements for amazing people around the world. I like work with new people. New people new Experiences. I truly enjoy what I'm doing, which makes me more passionate about web development and coding. I am always ready to do challenging tasks whether it is about creating a custom CMS from scratch or customizing an existing system.","sameAs":["https:\/\/codehim.com"],"url":"https:\/\/codehim.com\/author\/asif-mughal\/"}]}},"views":23306,"_links":{"self":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/posts\/6026","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/comments?post=6026"}],"version-history":[{"count":0,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/posts\/6026\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/media\/6029"}],"wp:attachment":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/media?parent=6026"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/categories?post=6026"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/tags?post=6026"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}