Solved

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

Posted on 2003-10-27
3
276 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
[X]
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
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
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.

737 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