{"id":940,"date":"2012-06-19T18:01:13","date_gmt":"2012-06-19T18:01:13","guid":{"rendered":"https:\/\/theextremewebdesigns.com\/blog\/?p=940"},"modified":"2012-06-19T18:01:13","modified_gmt":"2012-06-19T18:01:13","slug":"php-get-image-dimensions-get-image-width-height-using-php","status":"publish","type":"post","link":"https:\/\/theextremewebdesigns.com\/blog\/php-get-image-dimensions-get-image-width-height-using-php\/","title":{"rendered":"PHP Get Image Dimensions (Width &#038; Height) Examples"},"content":{"rendered":"<p>Have you ever wanted to get image dimensions \u00a0using PHP? In this article, I am going to share an easy way to <em><strong>use PHP to get image dimensions (width &amp; height)<\/strong><\/em>.<!--more--><\/p>\n<h2>Examples in PHP to Get Image Dimensions (Width &amp; Height)<\/h2>\n<p>Following is the complete HTML + PHP source code that shows how to <em><strong>get the image dimensions (width &amp; height)<\/strong><\/em> when the page is loaded:<\/p>\n<h3>Example: Get image width &amp; height (dimensions) using PHP<\/h3>\n<pre class=\"lang:xhtml decode:true\">&lt;html xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"&gt;\n&lt;head&gt;\n&lt;meta http-equiv=\"Content-Type\" content=\"text\/html; charset=utf-8\" \/&gt;\n&lt;title&gt;PHP Get Image Dimensions&lt;\/title&gt;\n&lt;\/head&gt;\n\n&lt;body&gt;\n\n&lt;?php\n\nlist($width, $height) = getimagesize(\"images\/banner.png\");\n\necho \"Width: \" .$width.\" Height: \" .$height;\n\n?&gt;\n\n&lt;\/body&gt;\n&lt;\/html&gt;<\/pre>\n<p>When the above code is executed, the page will echo the width and height of the image.<\/p>\n<h5>That&#8217;s it!<\/h5>\n<p>Do you know of any other ways to <em><strong>find image width and height using PHP<\/strong><\/em>? Feel free to share by commenting below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Have you ever wanted to get image dimensions \u00a0using PHP? In this article, I am going to share an easy way to use PHP to get image dimensions (width &amp; height).<\/p>\n","protected":false},"author":1,"featured_media":141,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[10,13],"tags":[83,33],"class_list":["post-940","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php-tips-and-tricks","category-tips-and-tricks","tag-php-get-image-dimensions","tag-php-tips"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/paBnQX-fa","jetpack_sharing_enabled":true,"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/posts\/940","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/comments?post=940"}],"version-history":[{"count":0,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/posts\/940\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/media?parent=940"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/categories?post=940"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/tags?post=940"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}