Hey guys, think I've just been staring at this problem too long to find out how simple it is to fix... worked with several methods of finding and saving image dimensions to MySQL (actually used this same method several times), but the MySQL width and height is not populating this time...

...

/*capture selected image, set paths, and upload to ftp*/
$image = $_FILES['image']['name'];
$target = "../img/";
$target = $target . $image;
move_uploaded_file($_FILES['image']['tmp_name'], $target);

...

/*Get image dimensions and rescale image*/
list($width, $height) = getimagesize("http://www.something.com/img/obits/".$image);
$scale = min((230/$width), (400/$height));
$width1  = ceil($scale*$width);
$height1 = ceil($scale*$height);

/*Update as needed*/
mysql_query
("
    INSERT INTO table (date, name ,image, width, height, detail)
    VALUES('$date','$name ','$image','$width1','$height1','$article')
", $con1)
or die(mysql_error());

The image is uploading to the ftp... I've set all correspong folders to 777 permissions. Everything works properly except populating width and height (both end up as zero). I've tried to just use $width and $height instead of $width1 and $height1 (skipping the scaling segment), with no luck. If anyone just happens to notice what I did wrong, any ideas are greatly appreciated.

Do you get an error message? If so, post it here.

No errors, seems to progess through as normal. Is there some way I could add a catch someplace to find out if there is something I'm missing perhaps?

The or die() is supposed to catch those. I think the getimagesize needs a filename, instead of an URL.

Yes! I just needed to make the getimagesize() a dynamically positioned link instead of static, IE: 'img/' instead of 'www.something.com/img/' ... saved me a lot of stress.

Thank you very much for your help pritaeas!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.