Jump to content

Image Display Issue


jester18

Recommended Posts

hello all,

 

Complete noob when it comes to PHP and MYSQL anyway I have put a series of images in my database, when trying to retrieve the images I just get a page of binary.

 

<?PHP

$link = mysql_connect("****","*****","");
mysql_select_db("***");


$query = "SELECT image,year,image_name,description FROM gallery";

$results = mysql_query($query);

echo "<?xml version=\"1.0\"?>\n";
echo "<images>\n";

while($line = mysql_fetch_array($results)) {
echo "<photo>" . $line["image"] . $line["image_name"]  . $line["year"]. $line["description"]  . "</photo> \n"; 
}

echo "</images>\n";

mysql_close($link);

?>

 

 

 

Anyone know what the issue could be?

 

Thanks all

Link to comment
Share on other sites

Many thanks tried to do as you suggested most likely I'm doing this completely wrong the error im getting;

Warning: Cannot modify header information - headers already sent by line 24

 

<?PHP

$link = mysql_connect("***","****","");
mysql_select_db("***");


$query = "SELECT image,year,image_name,description FROM gallery";

$results = mysql_query($query);

echo "<?xml version=\"1.0\"?>\n"; 

echo "<images>\n";

while($line = mysql_fetch_array($results)) {
echo "<photo>" . $line["image"] . "</photo>\n"; 
echo "<photoname>" . $line["image_name"] . "</photoname>\n";
echo "<photodes>" . $line["description"] . "</photodes>\n";
echo "<photoyear>" . $line["year"] . "</photoyear>\n";


}


header("Content-type: image/jpeg");
echo "</images>\n";

mysql_close($link);

?>

Link to comment
Share on other sites

Oh right I see, I wanted to display the physical image along with the details of the image and get PHP to output the XML so that Flash actionscript can read the XML.  :shrug: Thanks, sorry if I'm way off still learning all of this.

 

This can't be done, as if you were even to attempt to parse XML with a binary image within it'd come up with an obvious error as so.

 

The only way you can do this is to link to the image within the xml file, for actionscript to read.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.