Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2003-10-27
3
266 Views
Last Modified: 2010-04-03
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

0
Comment
Question by:gangsidestep
  • 2
3 Comments
 
LVL 5

Expert Comment

by:Calron
ID: 9628721
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
 

Author Comment

by:gangsidestep
ID: 9628971
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
 
LVL 5

Accepted Solution

by:
Calron earned 250 total points
ID: 9629196
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

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question