Hola!
Okay, here's the situation. I am trying to create a photo gallery where thumbnails are displayed and when they are clicked on, a new window pops up with the detail image. I want the new window to be the same size as the detail image. So I figured I would use the getimagesize function on the image and use the variables from that array for the height and width of the image. The problem I am having is when I try to use getimagesize on the script that is pulling the image from the database it gives me a bunch of errors. I think that it is not recognizing it as an image. Anyway, here's the code. Thanks.
-Jake-
// the script to pull the image from the database. "getimg1.php3"
// USE: <img src="getimg1.php3?id=$id"
<?php
if($id) {
mysql_connect( "localhost", "$db_user", "$db_pass" );
mysql_select_db( "$database" );
$query = "select image1, image1_type from $db_table where id=$id";
$result = mysql_query($query);
$data = mysql_result($result,0, "image1");
$type = mysql_result($result,0, "image1_type");
header("Content-type: $type");
echo $data;
};
?>
// this is working correctly
// the getimagesize script
<?
$image_file = "/getimg1.php3?id=$id";
$image_size = getimagesize($image_file);
print("<img src=\"$image_file\" $image_size[3]>\n");
print("<br>");
print("$image_size[0]<br>");
print("$image_size[1]<br>");
print("$image_size[2]<br>");
?>
// the errors
Warning: Unable to open /getimg1.php3?id=1 in /getimagesize.php3 on line 3
Warning: No such index in string in /getimagesize.php3 on line 4
//image displays here correctly, but with no width or height attributes//
Warning: No such index in string in /getimagesize.php3 on line 6
Warning: No such index in string in /getimagesize.php3 on line 7
Warning: No such index in string in /getimagesize.php3 on line 8
Thanks again!