2 Replies Latest reply on Oct 12, 2008 2:05 PM by Günter Schenk

    storing w and h with image upload

      Hi there,

      Is there a way to capture and store the dimensions of a image when using image upload?

      Thanks in advance,

        • 1. Re: storing w and h with image upload
          Waleed Barakat Level 1
          Hi, you can find it here:

          hope it help...
          • 2. Re: storing w and h with image upload
            Günter Schenk Level 4
            Hi Simon, <br /> <br />as I don´t know why you actually need to store the width &amp; height of an uploaded image, I´d like to point you to PHP´s native function "getimagesize" (http://de.php.net/getimagesize) which nicely retrieves these values without further ado -- here´s how I use to implement this function in PHP pages in order to assign the correct width &amp; height values to the image tag´s "width" respectively "height" attributes: <br /> <br />-------- <br /><?php<br />$rel_path = "../../relative_path_to_main_image_directory/";<br />$img_directory = $row_queryname['dir']."/";<br />$img_name = $row_queryname['column'];<br /><br />$path_composed = $rel_path.$img_directory.$img_name;<br /><br />$size = getimagesize ("$path_composed");<br />$img_width = $size[0];<br />$img_height = $size[1];<br />?> <br />-------- <br /> <br />in your page you can reuse the abovementioned variables this way: <br /> <br />img src="<?php echo $path_composed; ?>" width="<?php echo $img_width; ?>" height="<?php echo $img_height; ?>" border="0" <br /> <br />Cheers, <br />Günter Schenk <br />Adobe Community Expert, Dreamweaver