Have a look here...I have some sample code on calling images from a db. It
used the two pages like you do here and passes the ID back and forth to the
image production page...maybe it will help
http://www.weberdev.com/get_example-4062.html
bastien
From: Craig Hoffman <choffman@xxxxxxxxxx>
To: php-db@xxxxxxxxxxxxx
Subject: One more GD ? -- filename
Date: Wed, 6 Apr 2005 08:23:40 -0500
Thanks everyone for answering my other post. However, I'm still having
trouble passing the image name from the GD script to the image tag. I'm
including the GD script below. Any help would be great. Thanks - Craig
//GD script
<?php
include ("db.php");
$query = "SELECT route_photo FROM routes WHERE route_photo IS NOT NULL
ORDER BY RAND() LIMIT 1";
$result = mysql_query($query, $db) or die(mysql_error());
while($row = mysql_fetch_array($result)) {
//Photo varibale
$route_photo = $row["route_photo"];
//Start GD
//New Image resize
$new_width = 125;
$new_height = 225;
//Content Type
header("Content-type: image/jpeg");
//Start new image resize
list($width_orig, $height_orig) =
getImageSize("../images/climbs/$route_photo");
if ($new_width && ($width_orig < $height_orig)) {
$new_width = ($new_height / $height_orig) * $width_orig;
} else {
$new_height = ($new_width / $width_orig) * $height_orig;
}
//resample the image
$thumb = ImageCreateTrueColor($new_width, $new_height);
$tmp_image = ImageCreateFromJPEG("../images/climbs/$route_photo");
ImageCopyResampled($thumb, $tmp_image, 0, 0, 0, 0, $new_width,
$new_height, $width_orig, $height_orig);
ImageJPEG($thumb, $route_photo, '100');
ImageDestroy($thumb);
}
?>
//Image Tag:
echo ("<img src='include/function_gd.php?route_photo=$thumb'
align='center' id='image'>");
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php