PDA

View Full Version : Generating a full size image from a database


kona72
04-09-2006, 08:08 PM
Hey All,

I have a gallery that draws on information in a MySQL db. Everything so far is working just greta but i have a bit of a problem getting the full size image available for people to view. I have two images one 250px wide and the other is 750 px (thumb, fullsize) I have the thumb appearing on page load but I want the visitor to be able to view the full size is they wish. Here is the code for the auto-generated page.... My Database has 7 fields including one Primary_key field.

<?php require_once('../Connections/tpps.php'); ?>
<?php
$maxRows_rsNauticals = 10;
$pageNum_rsNauticals = 0;
if (isset($_GET['pageNum_rsNauticals'])) {
$pageNum_rsNauticals = $_GET['pageNum_rsNauticals'];
}
$startRow_rsNauticals = $pageNum_rsNauticals * $maxRows_rsNauticals;

mysql_select_db($database_tpps, $tpps);
$query_rsNauticals = "SELECT * FROM tpps_pics WHERE category = 'nauticals'";
$query_limit_rsNauticals = sprintf("%s LIMIT %d, %d", $query_rsNauticals, $startRow_rsNauticals, $maxRows_rsNauticals);
$rsNauticals = mysql_query($query_limit_rsNauticals, $tpps) or die(mysql_error());
$row_rsNauticals = mysql_fetch_assoc($rsNauticals);

if (isset($_GET['totalRows_rsNauticals'])) {
$totalRows_rsNauticals = $_GET['totalRows_rsNauticals'];
} else {
$all_rsNauticals = mysql_query($query_rsNauticals);
$totalRows_rsNauticals = mysql_num_rows($all_rsNauticals);
}
$totalPages_rsNauticals = ceil($totalRows_rsNauticals/$maxRows_rsNauticals)-1;
?>

And here is the "code" i have tried for the new full size page.

<?php require_once('../Connections/tpps.php'); ?>
<?php
mysql_select_db($database_tpps, $tpps);
$query_rsNauticalfull = "SELECT primary_key, title, category, fullsize, `desc` FROM tpps_pics WHERE category = ''nauticals';
$rsNauticalfull = mysql_query($query_rsNauticalfull, $tpps) or die(mysql_error());
$row_rsNauticalfull = mysql_fetch_assoc($rsNauticalfull);
$totalRows_rsNauticalfull = mysql_num_rows($rsNauticalfull);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>

<body>
/picgallery/<?php echo $row_rsNauticalfull['fullsize']; ?>
<?php echo $row_rsNauticalfull['primary_key']; ?>
</body>
</html>
<?php
mysql_free_result($rsNauticalfull);
?>

davidj
04-10-2006, 09:17 AM
echo this var ....

$row_rsNauticalfull['fullsize'];

check to see if contains anything

kona72
04-10-2006, 02:03 PM
It contains the appropriate info but i need it to carry the primary key over so it displays the appropriate full size image. Any ideas?

davidj
04-10-2006, 02:23 PM
post what it contains

kona72
04-12-2006, 05:37 PM
I got it figured out...


Click here for Full Size (/picgallery/<?php echo $row_rsNauticals['fullsize']; ?>)</p>

davidj
04-13-2006, 08:27 AM
great

your learning quickly