PDA

View Full Version : dynamic images


shimble
10-23-2008, 08:57 PM
i am trying to populate a page with a dynamic image stored on an image folder in the site root


i have created an image database and have uploaded the following image url to the database
c:\wamp\www\website\images\image

in the bindings panel i have created a recordset query for the image url
selcting just the image url with no filters or sort if i test this i get the imageurl in the test box
i then try to insert the image using data sources and image url

dw cannot properly convert live data from the server and when i check in the browser i have no image just a little box with a x in it anyone got any ideas where im going wrong

this is the code that dw has created .....


<?php require_once('Connections/conn_xxxxx.php'); ?>
<?php
mysql_select_db($database_conn_lxxxxx, $conn_xxxxx);
$query_Recordset1 = "SELECT `image url` FROM xxx_images";
$Recordset1 = mysql_query($query_Recordset1, $conn_xxxxx) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<img src="<?php echo $row_Recordset1['image url']; ?>" />
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>

edbr
10-24-2008, 02:57 AM
try inserting into your db
/images/image.gif or ../images\/image.gif depending which is the correct path.
then you will echo out
<img src=".../images/image.gif">

shimble
10-24-2008, 07:26 AM
thought that would do it as i hadnt put in the .extension in the db but still no joy im going round in circles can i use a .jpeg extension in the database as thats what the image is saved as
my long description of the image path is
images/image.jpeg
so i presume i should follow the same format for inserting into the db

or should the /become a \ or \/

or should i a http://localhost address rather than c://wamp.www address
its only easy when you know what ya doin

ive tried various combinations but none seem to work but if i use the image with simple file sysem link no dynamics it works fine

img src ="<?php echo $row_recordset1['image url']; ?> longdesc="xxxsite_images/DSCF3333.jpeg" />

edbr
10-24-2008, 08:19 AM
on you page echo the value
<?php echo $row_recordset1['image url']; ?>
your path has to be correct (site relative) so your source could read
<img src="images/<?php echo $row_Recordset1['image url']; ?>" /> depending on what you have entered in your db. so if you have entered my_photo.gif
the path will print
<img src="images/my_photo.gif" />

shimble
10-24-2008, 10:31 AM
on you page echo the value
<?php echo $row_recordset1['image url']; ?>
your path has to be correct (site relative) so your source could read
<img src="images/<?php echo $row_Recordset1['image url']; ?>" /> depending on what you have entered in your db. so if you have entered my_photo.gif
the path will print
<img src="images/my_photo.gif" />

thanks went thru it another half a dozen times and it boiled down to how i was entering the image url into the db i ended up copy the long description url format into the db i did not need the full c://wamp/website/webimages.... path but its working with the short path images/image
it seems to be working and i can even specify the image id and make that work too so thanks for your time no doubt i shall be back to ask another dumb question soon