loading image (Blob) files AND text from one php database table

Hi

I have successfully loaded text from mysql php database but cannot get a picture (gif or jpg)
from the same database to load into the same movie clip.

can you help??

david

gangsidestepAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CalronCommented:
Do you have the picure itself, the whole data stored in the database or just the filenames?
Flash does not have a way to read in bytestreams and construct the image inside of flash so you will have to construct it ourside of flash, easiest probably with php. Then either send it directly to flash from the php as a jpg, or save it as a temp file and pass the filename to flash.

Please tell me a bit more about how you have the images saved so I can help you out with your case.
0
gangsidestepAuthor Commented:
my images are stored in the database in BLOB form.
my php file looks like this

 <?php
mysql_connect("localhost","xxxxxxx","xxxxxxxx");
mysql_select_db("xxxxxxx");
$query = "SELECT * FROM concerts";
$result = MySQL_query($query);
While( $rows = MySQL_fetch_array($result) )
{
$st = $rows["date"];
$stamp = mktime(0, 0, 0, substr($st, 5, 2), substr($st, 8, 2), substr($st, 0, 4));
$venue = $rows['venue'];
$address = $rows['address'];
$hyperlink = $rows['hyperlink'];
$logo_file = $rows['logo_file'];

echo ("&date=".date("l F dS Y", $stamp)."&venue=$venue&address=$address&hyperlink=$hyperlink&logo_file=$logo_file");
}
MySQL_close()
?>

That gives ma a string that looks like this:

&date=Tuesday November 18th 2003&venue=Arlene Grocery&address=95 Stanton St.&hyperlink=&logo_file=arlenes.gif&date=Tuesday November 18th 2003&venue=Arlene's Grocery&address=95 Stanton St. - NY&hyperlink=http://www.arlene-grocery.com&logo_file=GIF89aÈ#ÕfÌ™33333ÌÌf™†††3™Ìf3ÿ33fÌÌf™™333ÿ™3UUUÌ33™ÌfÌÿ3ÿf33fÿÌ3f333ÌÿÌ™33f™3fff™Ì"""Ìf3™f3™ÌÿBBBff3fffffÿÌf3™™Ì™fwww)))MMM!ùÿ,È#ÿ@€pH,È¤rÉl:ŸÐ¨tJ­Z¯Ø¬vËí:«’U¡m6¡à‘15ÕD¨ÜµV«¥........"etc...etc"

I tried adapting the following php file from an example I found somewhere else and it worked fine even displaying the picture itself
when you opened the php file in a browser as long as the picture was the only element in the string.
But when I imported that code into my php file I keep getting an error message which says the header can't be changed


<?
$db = @mysql_connect(localhost, xxxxxx, xxxxxx) or
   die("Can't connect to server.");

@mysql_select_db("xxxxxx", $db) or
   die("Can't select database.");


$get_image = "select binary_junk,
   filetype from images where img_id = 1";

$get_image_result = @mysql_query($get_image)
   or die("Couldn't get image.");


$binary_junk = @mysql_result
($get_image_result,0,"binary_junk");

$filetype = @mysql_result
($get_image_result,0,"filetype");

header("Content-type: $filetype");
echo "$binary_junk";
?>


Thanks
David
0
CalronCommented:
What you have to do is make two calls. One to read in the text from the first php file. And the second to read in the jpg script. If the jpg script works in the browser, then you should be able to load it in as a picture into flash as well. But there is no way you can combine the text and the picture into one call, as flash either loads text, or pictures. To make sure that you have the same record for the picture and you could send along the some kind of id to the picture script,that way you can load that specific image into the script.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.