getimagesize help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bbaudoin
Forum Newbie
Posts: 5
Joined: Mon Sep 14, 2009 11:02 pm

getimagesize help

Post by bbaudoin »

having trouble with this code:

list($width, $height, $type, $attr) = getimagesize(getChosenPhoto($_GET['id']));
echo $width;

basically, all I want to do is grab various info like height or width from an image I have stored in a database.
if I use the code raw like this:

list($width, $height, $type, $attr) = getimagesize("images/fullsized/bob.jpg");
echo $width;

then it spits out the width. But, if I use it the above way it seems to just spit out this:
"images/fullsized/bob.jpg"

even if I put the get code into a string like this and feed it back through:

$hubbub = getChosenPhoto($_GET['id']);
list($width, $height, $type, $attr) = getimagesize($hubbub);
echo $width;

Still....nothing happens. :(
can't figure this out for thee life of me. Anybody have any solutions?
thanks so much for the help,
-Bayard
bbaudoin
Forum Newbie
Posts: 5
Joined: Mon Sep 14, 2009 11:02 pm

Re: getimagesize help

Post by bbaudoin »

database.php just refers to the mysql login info.
here you go:


function getChosenPhoto($the_selected_id) {
require 'database.php';
$id = $the_selected_id;

$q = "SELECT description, src FROM photo Where id = $id LIMIT 1";

$result = $mysqli->query($q) or die("there was a problem");

if($result) {
while ($row = $result->fetch_object()) {

$bullhonky = $row->src;

echo '"' . $bullhonky . '"';
}
} else die("There was some problem");
bbaudoin
Forum Newbie
Posts: 5
Joined: Mon Sep 14, 2009 11:02 pm

Re: getimagesize help

Post by bbaudoin »

thanks so much!!! this totally worked! :-O
Post Reply