Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can we find width and height of an image file being uploaded

Status
Not open for further replies.

amir4oracle

Programmer
Nov 3, 2004
46
CA
How can we find width and height of an image file being uploaded, I am using the following code:
Code:
<?php
require_once ('conn_db.php');

if (isset ($_POST['submit']))
{
for ($i=0; $i <= 3; $i++)
  if ($_FILES['photo']['name'][$i] != '')
    if(move_uploaded_file($_FILES['photo']['tmp_name'][$i], "images/" . basename($_FILES['photo']['name'][$i])))
       $pic[$i]  = ($_FILES['photo']['name'][$i]);

for ($i=0; $i <= 3; $i++)
  if ($pic[$i] != '')
    @mysql_query ("INSERT INTO images VALUES ('$i', '$pic[$i]')");

}
?>

<form enctype="multipart/form-data" action=<?php echo "picstest.php"?> method="POST"> 

<input type="file" name = "photo[]"> <br />
<input type="file" name = "photo[]"> <br />
<input type="file" name = "photo[]"> <br />
<input type="file" name = "photo[]"> <br />

<input type="submit" value=" Submit " name="submit">

</form>
Do we have to use JS etc or PHP itself what can we do to find out the width and height of the images users are uploading.
Your help is highly appreciated.
Thanks in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top