<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>javascript-get-image-dimensions &#8211; Extreme Web Designs</title>
	<atom:link href="https://theextremewebdesigns.com/blog/tag/javascript-get-image-dimensions/feed/" rel="self" type="application/rss+xml" />
	<link>https://theextremewebdesigns.com/blog</link>
	<description>Web Design and Web Development</description>
	<lastBuildDate>Tue, 19 Jun 2012 17:12:14 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.5</generator>
<site xmlns="com-wordpress:feed-additions:1">156673191</site>	<item>
		<title>JavaScript Get Image Dimensions (Width &#038; Height) Examples</title>
		<link>https://theextremewebdesigns.com/blog/javascript-get-image-dimensions-get-image-width-height/</link>
					<comments>https://theextremewebdesigns.com/blog/javascript-get-image-dimensions-get-image-width-height/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Tue, 19 Jun 2012 17:12:14 +0000</pubDate>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[javascript-demos]]></category>
		<category><![CDATA[javascript-get-image-dimensions]]></category>
		<category><![CDATA[javascript-tips]]></category>
		<guid isPermaLink="false">https://theextremewebdesigns.com/blog/?p=928</guid>

					<description><![CDATA[Have you ever wanted to get image dimensions using JavaScript? In this article, I am going to share an easy way to use JavaScript to get image dimensions (width &#38; height). How to use JavaScript to Get Image Dimensions (Width &#38; Height) Following is the complete HTML + JavaScript source code that shows how to get [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Have you ever wanted to get image dimensions using JavaScript? In this article, I am going to share an easy way to use <em><strong>JavaScript to get image dimensions (width &amp; height)</strong>.</em><span id="more-928"></span></p>
<h2>How to use JavaScript to Get Image Dimensions (Width &amp; Height)</h2>
<div class="make_demo">

	<form action="https://theextremewebdesigns.com/blog/wp-content/themes/ewd_blog_2017/try_demo.php?post_id=928" method="post" name="form1" target="_blank" id="form1">


	<input type="hidden" name="shortcode_content" id="shortcode_content" value="" />

        <div class="try_demo_btn_container">


            <button type="submit" name="sbt_make_demo" id="sbt_make_demo" class="btn-primary btn-try-demo">
                Try Demo
            </button>


        </div><!-- .try_demo_btn_container -->

    </form>
    </div>
    
<p>Following is the complete HTML + JavaScript source code that shows how to get the image dimensions (width &amp; height) when the page is loaded:</p>
<h3>Example: Get Image Width &amp; Height (dimensions) using JavaScript</h3>
<pre class="lang:xhtml decode:true">&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;Javascript Get Image Dimensions&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;

&lt;img src="images/banner.png" id="my_img" /&gt;

&lt;script type="text/javascript"&gt;

var img = document.getElementById('my_img');

var width = img.clientWidth;

var height = img.clientHeight;

alert( 'Width: ' + width + ' Height:' + height );

&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<p>The given code assumes that there is an image with ID &#8220;my_img&#8221; and the dimensions of this image needs to be found. When the above code is executed, the page will alert the width and height of the image.</p>
<h4>Note</h4>
<p>The image has to be completely loaded in order to get it&#8217;s size, or the width &amp; height values are incorrectly shown as zero.</p>
<div class="make_demo">

	<form action="https://theextremewebdesigns.com/blog/wp-content/themes/ewd_blog_2017/try_demo.php?post_id=928" method="post" name="form1" target="_blank" id="form1">


	<input type="hidden" name="shortcode_content" id="shortcode_content" value="" />

        <div class="try_demo_btn_container">


            <button type="submit" name="sbt_make_demo" id="sbt_make_demo" class="btn-primary btn-try-demo">
                Try Demo
            </button>


        </div><!-- .try_demo_btn_container -->

    </form>
    </div>
    
<h5>That&#8217;s it!</h5>
<p>Do you know of any other ways to <em><strong>find image width and height using JavaScript</strong></em>? Feel free to share by commenting below.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://theextremewebdesigns.com/blog/javascript-get-image-dimensions-get-image-width-height/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">928</post-id>	</item>
	</channel>
</rss>
