Hello
Would you please help me to display a swf file that is stored in a database (blob).
let us say I can manage to echo $swf; which produces a screen full of wierd chars (binary data).
What I need to know is where to go from here! regarding properly retrving data & displaying it in php or html.
I am stuc with those two values in macromedia <object> ... </object>:
"Movie" VALUE=" ? "
"Src" VALUE="? "
Usually those will point to a file location. In this case the file is in the database.
sample code will be great help
Thanks
Help displaying swf stored in DB
Moderator: General Moderators
- maliskoleather
- Forum Contributor
- Posts: 155
- Joined: Tue May 15, 2007 2:19 am
- Contact:
i do something simmilar using images... the concept is the same, you'd just have to modify the headers and stuff to match a swf file..
my code:
in the html page: (where # is the image id number)
image_generator.php:
keep in mind, this is a copy-and-paste example, where i cut some irrelevent chunks out of the code... it could be alot more secure.. but this is just to give you a basic example of how to execute it...
my code:
in the html page: (where # is the image id number)
Code: Select all
<img src="image_generator.php?id=#" />Code: Select all
$data = doQuery("SELECT data,type,imagetype FROM banners WHERE id='".$_GET['id']."' LIMIT 0,1",3600);
printbanner($data);
// i should note that doQuery is a custom function that returns an associative array based off the SQL - its the same as mysql_query()
function printbanner($data){
header('Content-type: '.$data['imagetype']);
header('Expires: Tue, 22 May 1988 03:20:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, n0-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
echo($data['data']);
}