{"id":127,"date":"2026-09-30T14:02:24","date_gmt":"2026-09-30T14:02:24","guid":{"rendered":"https:\/\/sarkariresultme.com\/?page_id=127"},"modified":"2026-09-30T14:11:23","modified_gmt":"2026-09-30T14:11:23","slug":"photo-resizer","status":"publish","type":"page","link":"https:\/\/sarkariresultme.com\/hi\/photo-resizer\/","title":{"rendered":"Photo Resizer"},"content":{"rendered":"\r\n    <div class=\"srm-resizer-box\">\r\n        <div id=\"ez-toc-container\" class=\"ez-toc-v2_0_88 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/sarkariresultme.com\/hi\/photo-resizer\/#Photo_Resizer\" >Photo Resizer<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/sarkariresultme.com\/hi\/photo-resizer\/#Preview\" >Preview<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"Photo_Resizer\"><\/span>Photo Resizer<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n        <p>Upload an image, set the required width and height, then download the resized image.<\/p>\r\n\r\n        <input type=\"file\" id=\"srmPhotoInput\" accept=\"image\/*\">\r\n\r\n        <div class=\"srm-resizer-grid\">\r\n            <div>\r\n                <label>Width (px)<\/label>\r\n                <input type=\"number\" id=\"srmWidth\" placeholder=\"e.g. 300\" min=\"1\">\r\n            <\/div>\r\n\r\n            <div>\r\n                <label>Height (px)<\/label>\r\n                <input type=\"number\" id=\"srmHeight\" placeholder=\"e.g. 400\" min=\"1\">\r\n            <\/div>\r\n        <\/div>\r\n\r\n        <label class=\"srm-check-row\">\r\n            <input type=\"checkbox\" id=\"srmKeepRatio\" checked>\r\n            Keep aspect ratio\r\n        <\/label>\r\n\r\n        <button type=\"button\" id=\"srmResizeBtn\">Resize Photo<\/button>\r\n\r\n        <div id=\"srmPreviewWrap\" style=\"display:none;\">\r\n            <h3><span class=\"ez-toc-section\" id=\"Preview\"><\/span>Preview<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n            <canvas id=\"srmCanvas\"><\/canvas>\r\n            <br>\r\n            <a id=\"srmDownloadBtn\" download=\"resized-photo.png\">Download Resized Photo<\/a>\r\n        <\/div>\r\n    <\/div>\r\n\r\n    <style>\r\n    .srm-resizer-box {\r\n        max-width: 760px;\r\n        margin: 30px auto;\r\n        background: #fff;\r\n        padding: 28px;\r\n        border-radius: 16px;\r\n        box-shadow: 0 6px 20px rgba(0,0,0,.08);\r\n    }\r\n\r\n    .srm-resizer-box h2 {\r\n        text-align: center;\r\n        color: #a10f46;\r\n        margin-bottom: 10px;\r\n    }\r\n\r\n    .srm-resizer-box p {\r\n        text-align: center;\r\n        margin-bottom: 22px;\r\n        color: #555;\r\n    }\r\n\r\n    .srm-resizer-box input[type=\"file\"],\r\n    .srm-resizer-box input[type=\"number\"] {\r\n        width: 100%;\r\n        padding: 12px;\r\n        border: 1px solid #ddd;\r\n        border-radius: 8px;\r\n        box-sizing: border-box;\r\n    }\r\n\r\n    .srm-resizer-grid {\r\n        display: grid;\r\n        grid-template-columns: 1fr 1fr;\r\n        gap: 14px;\r\n        margin-top: 18px;\r\n    }\r\n\r\n    .srm-resizer-grid label {\r\n        display: block;\r\n        font-weight: 700;\r\n        margin-bottom: 6px;\r\n    }\r\n\r\n    .srm-check-row {\r\n        display: flex;\r\n        align-items: center;\r\n        gap: 8px;\r\n        margin-top: 16px;\r\n        font-weight: 600;\r\n    }\r\n\r\n    #srmResizeBtn {\r\n        margin-top: 20px;\r\n        width: 100%;\r\n        padding: 14px;\r\n        border: none;\r\n        border-radius: 30px;\r\n        background: linear-gradient(135deg,#8f0f3f,#d52d68);\r\n        color: #fff;\r\n        font-size: 17px;\r\n        font-weight: 800;\r\n        cursor: pointer;\r\n    }\r\n\r\n    #srmPreviewWrap {\r\n        margin-top: 24px;\r\n        text-align: center;\r\n    }\r\n\r\n    #srmCanvas {\r\n        max-width: 100%;\r\n        height: auto;\r\n        border: 1px solid #ddd;\r\n        border-radius: 10px;\r\n    }\r\n\r\n    #srmDownloadBtn {\r\n        display: inline-block;\r\n        margin-top: 14px;\r\n        padding: 12px 24px;\r\n        background: #1765d1;\r\n        color: #fff;\r\n        text-decoration: none;\r\n        border-radius: 999px;\r\n        font-weight: 700;\r\n    }\r\n\r\n    @media (max-width: 600px) {\r\n        .srm-resizer-grid {\r\n            grid-template-columns: 1fr;\r\n        }\r\n    }\r\n    <\/style>\r\n\r\n    <script>\r\n    document.addEventListener('DOMContentLoaded', function() {\r\n\r\n        const input = document.getElementById('srmPhotoInput');\r\n        const widthInput = document.getElementById('srmWidth');\r\n        const heightInput = document.getElementById('srmHeight');\r\n        const keepRatio = document.getElementById('srmKeepRatio');\r\n        const resizeBtn = document.getElementById('srmResizeBtn');\r\n        const canvas = document.getElementById('srmCanvas');\r\n        const previewWrap = document.getElementById('srmPreviewWrap');\r\n        const downloadBtn = document.getElementById('srmDownloadBtn');\r\n\r\n        let img = new Image();\r\n        let originalWidth = 0;\r\n        let originalHeight = 0;\r\n\r\n        input.addEventListener('change', function(e) {\r\n            const file = e.target.files[0];\r\n            if (!file) return;\r\n\r\n            const reader = new FileReader();\r\n\r\n            reader.onload = function(event) {\r\n                img.onload = function() {\r\n                    originalWidth = img.width;\r\n                    originalHeight = img.height;\r\n\r\n                    widthInput.value = originalWidth;\r\n                    heightInput.value = originalHeight;\r\n                };\r\n\r\n                img.src = event.target.result;\r\n            };\r\n\r\n            reader.readAsDataURL(file);\r\n        });\r\n\r\n        widthInput.addEventListener('input', function() {\r\n            if (keepRatio.checked && originalWidth && originalHeight) {\r\n                heightInput.value = Math.round(\r\n                    widthInput.value * originalHeight \/ originalWidth\r\n                );\r\n            }\r\n        });\r\n\r\n        heightInput.addEventListener('input', function() {\r\n            if (keepRatio.checked && originalWidth && originalHeight) {\r\n                widthInput.value = Math.round(\r\n                    heightInput.value * originalWidth \/ originalHeight\r\n                );\r\n            }\r\n        });\r\n\r\n        resizeBtn.addEventListener('click', function() {\r\n\r\n            if (!img.src) {\r\n                alert('Please upload a photo first.');\r\n                return;\r\n            }\r\n\r\n            const width = parseInt(widthInput.value);\r\n            const height = parseInt(heightInput.value);\r\n\r\n            if (!width || !height) {\r\n                alert('Please enter valid width and height.');\r\n                return;\r\n            }\r\n\r\n            canvas.width = width;\r\n            canvas.height = height;\r\n\r\n            const ctx = canvas.getContext('2d');\r\n            ctx.clearRect(0, 0, width, height);\r\n            ctx.drawImage(img, 0, 0, width, height);\r\n\r\n            const dataUrl = canvas.toDataURL('image\/png');\r\n\r\n            downloadBtn.href = dataUrl;\r\n            previewWrap.style.display = 'block';\r\n        });\r\n\r\n    });\r\n    <\/script>\r\n\r\n    \n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-127","page","type-page","status-publish","hentry"],"_hostinger_reach_plugin_has_subscription_block":false,"_hostinger_reach_plugin_is_elementor":false,"_links":{"self":[{"href":"https:\/\/sarkariresultme.com\/hi\/wp-json\/wp\/v2\/pages\/127","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sarkariresultme.com\/hi\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/sarkariresultme.com\/hi\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/sarkariresultme.com\/hi\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sarkariresultme.com\/hi\/wp-json\/wp\/v2\/comments?post=127"}],"version-history":[{"count":3,"href":"https:\/\/sarkariresultme.com\/hi\/wp-json\/wp\/v2\/pages\/127\/revisions"}],"predecessor-version":[{"id":132,"href":"https:\/\/sarkariresultme.com\/hi\/wp-json\/wp\/v2\/pages\/127\/revisions\/132"}],"wp:attachment":[{"href":"https:\/\/sarkariresultme.com\/hi\/wp-json\/wp\/v2\/media?parent=127"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}