0

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.

Edited by PsychicTide

2
Contributors
4
Replies
31
Views
4 Years
Discussion Span
Last Post by PsychicTide
0

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?

Edited by PsychicTide

1

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

0

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!

Edited by PsychicTide

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.