{"id":282,"date":"2011-09-11T17:06:04","date_gmt":"2011-09-11T17:06:04","guid":{"rendered":"http:\/\/www.websitedesignwebsitedevelopment.com\/?p=282"},"modified":"2014-03-19T09:14:17","modified_gmt":"2014-03-19T09:14:17","slug":"how-to-get-image-ratio-for-resize","status":"publish","type":"post","link":"https:\/\/androidbubble.com\/blog\/website-development\/image-manipulation\/how-to-get-image-ratio-for-resize\/","title":{"rendered":"How to get image ratio for resize?"},"content":{"rendered":"<h2>How to get image ratio for resize?<\/h2>\n<p>It is an obvious question specially when you have to manipulate an image from small size to large or from large to small. As one of my friend don&#8217;t like to invent again a wheel but here we have to understand the manufacturing of a wheel for promising results.<br \/>\n<a href=\"http:\/\/www.websitedesignwebsitedevelopment.com\/wp-content\/uploads\/2011\/09\/php_wdwd.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignright size-full wp-image-304\" title=\"php_wdwd\" src=\"http:\/\/www.websitedesignwebsitedevelopment.com\/wp-content\/uploads\/2011\/09\/php_wdwd.png\" alt=\"\" width=\"200\" height=\"105\" align=\"right\" \/><\/a><\/p>\n<p>So dudes, suppose you have an image with<\/p>\n<p><strong>width:<\/strong> 1024px<\/p>\n<p><strong>height:<\/strong> 768<\/p>\n<p>And you have to find out the ratio, simply check our the formula from adobe photoshop resizing input fields.<\/p>\n<p>Ratio: w\/h<\/p>\n<p>I have improved this formula for more clarity in php function that<\/p>\n<p>pseudo code:<\/p>\n<p>if(w&gt;h)<\/p>\n<p>ratio=w\/h<\/p>\n<p>else<\/p>\n<p>ratio=h\/w<\/p>\n<p>Now, you have to resize an image proportionally. Simply you should know either what width you want for resized image or what height because only one of them is required and the second attribute of resized image will be calculated proportionally.<\/p>\n<p>This post was about how to get image ratio for resize, i will further post regarding resizing formula and php function for resizing an image.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to get image ratio for resize? It is an obvious question specially when you have to manipulate an image from small size to large or from large to small. As one of my friend don&#8217;t like to invent again a wheel but here we have to understand the manufacturing of a wheel for promising [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":304,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[25],"tags":[],"class_list":["post-282","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-image-manipulation"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to get image ratio for resize?<\/title>\n<meta name=\"description\" content=\"how to get image ratio to resize an image is a helping post for those guys who have to calculate the dimensions of an image manually while resizing\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/androidbubble.com\/blog\/website-development\/image-manipulation\/how-to-get-image-ratio-for-resize\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to get image ratio for resize?\" \/>\n<meta property=\"og:description\" content=\"how to get image ratio to resize an image is a helping post for those guys who have to calculate the dimensions of an image manually while resizing\" \/>\n<meta property=\"og:url\" content=\"https:\/\/androidbubble.com\/blog\/website-development\/image-manipulation\/how-to-get-image-ratio-for-resize\/\" \/>\n<meta property=\"og:site_name\" content=\"AndroidBubble Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/pages\/Website-Design-Website-Development\/172363336135453\" \/>\n<meta property=\"article:published_time\" content=\"2011-09-11T17:06:04+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2014-03-19T09:14:17+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/androidbubble.com\/blog\/wp-content\/uploads\/2011\/09\/php_wdwd.png\" \/>\n\t<meta property=\"og:image:width\" content=\"200\" \/>\n\t<meta property=\"og:image:height\" content=\"105\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Fahad\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Fahad\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/androidbubble.com\/blog\/website-development\/image-manipulation\/how-to-get-image-ratio-for-resize\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/androidbubble.com\/blog\/website-development\/image-manipulation\/how-to-get-image-ratio-for-resize\/\"},\"author\":{\"name\":\"Fahad\",\"@id\":\"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/0a833b633f744c3a5e0de7c9a94e71f7\"},\"headline\":\"How to get image ratio for resize?\",\"datePublished\":\"2011-09-11T17:06:04+00:00\",\"dateModified\":\"2014-03-19T09:14:17+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/androidbubble.com\/blog\/website-development\/image-manipulation\/how-to-get-image-ratio-for-resize\/\"},\"wordCount\":188,\"image\":{\"@id\":\"https:\/\/androidbubble.com\/blog\/website-development\/image-manipulation\/how-to-get-image-ratio-for-resize\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/androidbubble.com\/blog\/wp-content\/uploads\/2011\/09\/php_wdwd.png\",\"articleSection\":[\"Image Manipulation\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/androidbubble.com\/blog\/website-development\/image-manipulation\/how-to-get-image-ratio-for-resize\/\",\"url\":\"https:\/\/androidbubble.com\/blog\/website-development\/image-manipulation\/how-to-get-image-ratio-for-resize\/\",\"name\":\"How to get image ratio for resize?\",\"isPartOf\":{\"@id\":\"https:\/\/androidbubble.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/androidbubble.com\/blog\/website-development\/image-manipulation\/how-to-get-image-ratio-for-resize\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/androidbubble.com\/blog\/website-development\/image-manipulation\/how-to-get-image-ratio-for-resize\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/androidbubble.com\/blog\/wp-content\/uploads\/2011\/09\/php_wdwd.png\",\"datePublished\":\"2011-09-11T17:06:04+00:00\",\"dateModified\":\"2014-03-19T09:14:17+00:00\",\"author\":{\"@id\":\"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/0a833b633f744c3a5e0de7c9a94e71f7\"},\"description\":\"how to get image ratio to resize an image is a helping post for those guys who have to calculate the dimensions of an image manually while resizing\",\"breadcrumb\":{\"@id\":\"https:\/\/androidbubble.com\/blog\/website-development\/image-manipulation\/how-to-get-image-ratio-for-resize\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/androidbubble.com\/blog\/website-development\/image-manipulation\/how-to-get-image-ratio-for-resize\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/androidbubble.com\/blog\/website-development\/image-manipulation\/how-to-get-image-ratio-for-resize\/#primaryimage\",\"url\":\"https:\/\/androidbubble.com\/blog\/wp-content\/uploads\/2011\/09\/php_wdwd.png\",\"contentUrl\":\"https:\/\/androidbubble.com\/blog\/wp-content\/uploads\/2011\/09\/php_wdwd.png\",\"width\":\"200\",\"height\":\"105\",\"caption\":\"PHP: Hypertext Preprocessor\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/androidbubble.com\/blog\/website-development\/image-manipulation\/how-to-get-image-ratio-for-resize\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/androidbubble.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Website Development\",\"item\":\"https:\/\/androidbubble.com\/blog\/category\/website-development\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Image Manipulation\",\"item\":\"https:\/\/androidbubble.com\/blog\/category\/website-development\/image-manipulation\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"How to get image ratio for resize?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/androidbubble.com\/blog\/#website\",\"url\":\"https:\/\/androidbubble.com\/blog\/\",\"name\":\"AndroidBubble Blog\",\"description\":\"Articles &amp; Posts\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/androidbubble.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/0a833b633f744c3a5e0de7c9a94e71f7\",\"name\":\"Fahad\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/afab5bcad71955d142a69df1758e6710aed4ab9cc2b5da28c54a7c3f39801b73?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/afab5bcad71955d142a69df1758e6710aed4ab9cc2b5da28c54a7c3f39801b73?s=96&d=mm&r=g\",\"caption\":\"Fahad\"},\"sameAs\":[\"http:\/\/www.androidbubbles.com\/\",\"https:\/\/x.com\/phpFlex\"],\"url\":\"https:\/\/androidbubble.com\/blog\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to get image ratio for resize?","description":"how to get image ratio to resize an image is a helping post for those guys who have to calculate the dimensions of an image manually while resizing","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:\/\/androidbubble.com\/blog\/website-development\/image-manipulation\/how-to-get-image-ratio-for-resize\/","og_locale":"en_US","og_type":"article","og_title":"How to get image ratio for resize?","og_description":"how to get image ratio to resize an image is a helping post for those guys who have to calculate the dimensions of an image manually while resizing","og_url":"https:\/\/androidbubble.com\/blog\/website-development\/image-manipulation\/how-to-get-image-ratio-for-resize\/","og_site_name":"AndroidBubble Blog","article_publisher":"https:\/\/www.facebook.com\/pages\/Website-Design-Website-Development\/172363336135453","article_published_time":"2011-09-11T17:06:04+00:00","article_modified_time":"2014-03-19T09:14:17+00:00","og_image":[{"width":200,"height":105,"url":"https:\/\/androidbubble.com\/blog\/wp-content\/uploads\/2011\/09\/php_wdwd.png","type":"image\/png"}],"author":"Fahad","twitter_misc":{"Written by":"Fahad","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/androidbubble.com\/blog\/website-development\/image-manipulation\/how-to-get-image-ratio-for-resize\/#article","isPartOf":{"@id":"https:\/\/androidbubble.com\/blog\/website-development\/image-manipulation\/how-to-get-image-ratio-for-resize\/"},"author":{"name":"Fahad","@id":"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/0a833b633f744c3a5e0de7c9a94e71f7"},"headline":"How to get image ratio for resize?","datePublished":"2011-09-11T17:06:04+00:00","dateModified":"2014-03-19T09:14:17+00:00","mainEntityOfPage":{"@id":"https:\/\/androidbubble.com\/blog\/website-development\/image-manipulation\/how-to-get-image-ratio-for-resize\/"},"wordCount":188,"image":{"@id":"https:\/\/androidbubble.com\/blog\/website-development\/image-manipulation\/how-to-get-image-ratio-for-resize\/#primaryimage"},"thumbnailUrl":"https:\/\/androidbubble.com\/blog\/wp-content\/uploads\/2011\/09\/php_wdwd.png","articleSection":["Image Manipulation"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/androidbubble.com\/blog\/website-development\/image-manipulation\/how-to-get-image-ratio-for-resize\/","url":"https:\/\/androidbubble.com\/blog\/website-development\/image-manipulation\/how-to-get-image-ratio-for-resize\/","name":"How to get image ratio for resize?","isPartOf":{"@id":"https:\/\/androidbubble.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/androidbubble.com\/blog\/website-development\/image-manipulation\/how-to-get-image-ratio-for-resize\/#primaryimage"},"image":{"@id":"https:\/\/androidbubble.com\/blog\/website-development\/image-manipulation\/how-to-get-image-ratio-for-resize\/#primaryimage"},"thumbnailUrl":"https:\/\/androidbubble.com\/blog\/wp-content\/uploads\/2011\/09\/php_wdwd.png","datePublished":"2011-09-11T17:06:04+00:00","dateModified":"2014-03-19T09:14:17+00:00","author":{"@id":"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/0a833b633f744c3a5e0de7c9a94e71f7"},"description":"how to get image ratio to resize an image is a helping post for those guys who have to calculate the dimensions of an image manually while resizing","breadcrumb":{"@id":"https:\/\/androidbubble.com\/blog\/website-development\/image-manipulation\/how-to-get-image-ratio-for-resize\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/androidbubble.com\/blog\/website-development\/image-manipulation\/how-to-get-image-ratio-for-resize\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/androidbubble.com\/blog\/website-development\/image-manipulation\/how-to-get-image-ratio-for-resize\/#primaryimage","url":"https:\/\/androidbubble.com\/blog\/wp-content\/uploads\/2011\/09\/php_wdwd.png","contentUrl":"https:\/\/androidbubble.com\/blog\/wp-content\/uploads\/2011\/09\/php_wdwd.png","width":"200","height":"105","caption":"PHP: Hypertext Preprocessor"},{"@type":"BreadcrumbList","@id":"https:\/\/androidbubble.com\/blog\/website-development\/image-manipulation\/how-to-get-image-ratio-for-resize\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/androidbubble.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Website Development","item":"https:\/\/androidbubble.com\/blog\/category\/website-development\/"},{"@type":"ListItem","position":3,"name":"Image Manipulation","item":"https:\/\/androidbubble.com\/blog\/category\/website-development\/image-manipulation\/"},{"@type":"ListItem","position":4,"name":"How to get image ratio for resize?"}]},{"@type":"WebSite","@id":"https:\/\/androidbubble.com\/blog\/#website","url":"https:\/\/androidbubble.com\/blog\/","name":"AndroidBubble Blog","description":"Articles &amp; Posts","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/androidbubble.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/0a833b633f744c3a5e0de7c9a94e71f7","name":"Fahad","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/afab5bcad71955d142a69df1758e6710aed4ab9cc2b5da28c54a7c3f39801b73?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/afab5bcad71955d142a69df1758e6710aed4ab9cc2b5da28c54a7c3f39801b73?s=96&d=mm&r=g","caption":"Fahad"},"sameAs":["http:\/\/www.androidbubbles.com\/","https:\/\/x.com\/phpFlex"],"url":"https:\/\/androidbubble.com\/blog\/author\/admin\/"}]}},"views":722,"jetpack_featured_media_url":"https:\/\/androidbubble.com\/blog\/wp-content\/uploads\/2011\/09\/php_wdwd.png","_links":{"self":[{"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/posts\/282","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/comments?post=282"}],"version-history":[{"count":5,"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/posts\/282\/revisions"}],"predecessor-version":[{"id":306,"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/posts\/282\/revisions\/306"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/media\/304"}],"wp:attachment":[{"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/media?parent=282"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/categories?post=282"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/tags?post=282"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}