Solved

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

Posted on 2003-10-27
3
271 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

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

Suggested Solutions

Title # Comments Views Activity
Error 2032 in all the browser 6 2,875
Microsoft WSUS 4 110
bandwidth 5 80
deploy Adobe and Java updates to 100 workstations using LogMeIn Pro? 5 167
This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…

679 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