Hi,
I need to grab the width and height info from an uploaded image and stick it into my db record. I can get the info, but cannot get it into the db! For some reason, every time I INSERT these values, they come out as "127", the same number every time. However, when I print out the contents of the variable to the page, the correct values are shown.
Hears the code (gets info from submitted form, then...)
copy ($FILES['imagefile_large']['tmp_name'], "art/".$FILES['imagefile_large']['name']) or die ("Could not copy");
extract($_FILES['imagefile_large']); // "Extract" image info, which makes $name equal the file name of the image
$img_lg = $name; // Get image name
list($img_lg_sizew, $img_lg_sizeh, $type, $attr) = getimagesize("art/$name"); // Get width and height of image
Now, echoing $img_lg_sizew spits out the correct width of the image. But INSERTING the variable (as below) into the db results in "127" in each field.
$sql = "INSERT INTO paintings (title,cat,img_lg,img_lg_sizew,img_lg_sizeh) VALUES ('$title','$cat','$img_lg','$img_lg_sizew','$img_lg_sizeh')";
Help! 🙂
John