Hi,
You can't save an image from Flash without a server side script...
Mario's example sends an image to the server, then uses
FileReference to download it, or something similar. If you want to
store the image data, you would need to have 2 scripts - one to format
it nicely and then put it in the database - Mario's script saves to a
temporary file, you need to save the data to your DB here and get the id
back. The other one which takes in an ID of the data in the database
and then echoes out headers and the data which means your browser /
Flash will see an image.
Mario's example PHP script is pretty chunky and not very easy to see
where you would split the two bits of functionality, but instead of
writing a temporary image file, you would store your data in a database
and return the mysql_insert_id() to Flash, or similar.
Then you can use this ID to retrieve the image using a second
script. Provided you have encoded your JPG nicely, you can splurge it
out - here are some searches that may help, but the basic principle is
that you can do something like this:
<?php
ob_start();
$error = false;
$data = null;
//You would need to write these functions the ob_start & ob_end
stops you getting errors...
$id = sanitizeUserInput($_REQUEST['imageid']); // should return
a nice number for your database ID, or FALSE if you have a problem
if(FALSE === $id) {
$error = true;
} else {
$data = readDataFromDB($id); //should output your data as an
entire JPEG file or return FALSE if you have a problem.
}
if(FALSE === $data) {
$error = true;
}
ob_end_clean();
if(false == $error) {
header("Content-type: image/jpeg");
echo $data;
} else {
header(HTTP/1.0 404 Not Found");
}
exit();
?>
Some searches that might help you find some examples...
http://www.google.co.uk/search?hl=en&q=php+echo+image+from+database&btnG=Google+Search&meta=
<http://www.google.co.uk/search?hl=en&q=php+echo+image+from+database&btnG=Google+Search&meta=>
http://www.google.co.uk/search?hl=en&sa=X&oi=spell&resnum=0&ct=result&cd=1&q=php+read+image+from+database+blob&spell=1
<http://www.google.co.uk/search?hl=en&sa=X&oi=spell&resnum=0&ct=result&cd=1&q=php+read+image+from+database+blob&spell=1>
Hope this helps a bit - it's a long time since I did any image
manipulation in PHP, so apologies if the answers are a bit vague, but
there are loads of examples out there for this.
Glen
Omar Fouad wrote:
I see, all those tutorials shows how to save the image on the Hard Drive
(now with flash player is possible to do this without any server side
script).
But considering my question, what I should be putting in my database row,
the byteArray encoded by JPGEncoder?
Is there a method into this class that takes the ByteArray from the database
back, and translates it into a bitmap to be shown in the swf?
On Fri, Aug 15, 2008 at 12:42 PM, Glen Pike <[EMAIL PROTECTED]>wrote:
Hi,
Sorry, I put this in the wrong thread before - here is my 2c
Hi,
There are a few examples on the www about sending Bitmap data to the
server Mario's is a good starting point -
http://www.quasimondo.com/archives/000572.php Anyway, there are other
examples about which do compression/decompression on your data so you could
save it into your DB too..
Hope this is useful
Glen
--
Glen Pike
01326 218440
www.glenpike.co.uk <http://www.glenpike.co.uk>
______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
--
Glen Pike
01326 218440
www.glenpike.co.uk <http://www.glenpike.co.uk>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders