Forum Moderators: coopster
<!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>
<style type="text/css">
<!--
body {
background-color: #000000;
}
body,td,th {
color: #9900FF;
}
-->
</style>
<div align="center">
<?php
$con = mysql_connect("mysql#*$!#*$!#*$!#*$!#*$!", "#*$!#*$!#*$!#*$!", "#*$!#*$!#*$!x");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("#*$!#*$!#*$!", $con);
$result = mysql_query("SELECT * FROM geri ORDER BY cd");
while($row = mysql_fetch_array($result)){
echo $row['cd'];
echo "<br />";
}
mysql_close($con);
?></head>
<body>
<div align="center"><tr><td><img src="<?= $row[cd] ?>"></td></tr></div>
</body>
</html>
i left in the echo $row['cd']; line just to check that im getting the right information back from the database and thats fine.
it adds a blank image box though instead of an image.
and i want to see all images in a row underneath each other in the site.
cant seem to figure that bit out yet.
the image name in the database should be all i need to show the image surely?
ive submitted the full path and the local path but i still get a blank image placed on screen.
heres what im getting when i goto the page... <snip>
ive had a few suggestions from someone but i still cant get it to work.
the images are all the same size and will fit into a table down the middle of the site.
hope someone can help
jeff
[edited by: eelixduppy at 7:17 pm (utc) on Feb. 13, 2008]
[edit reason] no URLs, please [/edit]
if (!$result)
{
echo("Error performing query: " . mysql_error() . "");
exit();
}
while ( $row = mysql_fetch_array($result) )
{
$encodeddata = $row["sixfourdata"];
}
header('Content-type: image/jpeg');
echo base64_decode($encodeddata);
?>
You need something like this to get it to work....
i can do this succesfully and retrieve the results and echo them onto the page.
what i cant get them to do is show up as an image.
the information that is retrieved is the file path that i put into teh database.
i thought this would do want i want but all it shows is an empty image box on the webpage.
and it only shows 1 and not the full retrieved information.
im stuck now
?>
<div align="center"><tr><td><img src="<?= $pic[cd]; ?>" width="500" height="250" /><?php echo "<br />";?> </td></tr></div>
as phranque mentioned, can you access these images in your browser?
here's a wild guess
images/redress.jpeg
so I am guessing images is located at the root of the site and if your path is like the above it may not work, depending on where on the site you are, maybe try this
/images/redress.jpeg
which is an absolute path from root, the equivalent full url would be
http://www.example.com/images/redress.jpeg
i can see the files in my browser and have used them before in the website so it shouldnt be a problem.
im lost again now...
tried everything you have all suggested but it still wont work.
if anyone can write me a full example of what i need i'd be grateful.
have you viewed the image file in your browser in html?
or have you viewed the image file by directly accessing the image as http://www.example.com/images/redress.jpeg?
(and is it really .jpeg or is it .jpg?)
is your script running in the server root directory?
i have tried it with different images also not just that one.
yes the script is running in the root as is the full pages that i need this bit of imagery for.
i must be missing something somewhere but i cant put my finger on it.
then you can put this
<div align="center"><tr><td><img src="<?= $pic['cd']; ?>" width="500" height="250" /><br /></td></tr></div>
if $pic['cd'] has a value of /images/redress.jpg
you should view source on these pages to see what html is actually getting output, this seems like a path problem, you need to be 100% sure that your path is getting output properly and then check the html to be sure it is correct, then you can scratch those off the list and look to something else
i dont want to give up on this idea cos its still the easiest way to overcome what i need to do,im sure.
If you have stored your JPG images in a CYMK format and view them in MSIE you will get an empty image container. If you use Firefox and attempt to view a CYMK-format JPG in the browser you will get an error message something like ...
The image “file:///C:/path/to/image/CMYK.jpg” cannot be displayed, because it contains errors.