Re: [Flashcoders] Binary Data Question

2008-08-16 Thread Juan Pablo Califano
I haven't used amfphp extensively, but it might be a problem in the type of data amfphp expects... I'm not sure this is a good idea: ba.toString() As with a JPG you'll sure get lots of 0's in the ByteArray; parsed as a char in a string, a 0 value is what's known as an embedded null, which

Re: [Flashcoders] Binary Data Question

2008-08-16 Thread Omar Fouad
When I use ba without toString() amfphp says Object of class ByteArray could not be converted to string. I think there is something to be done in the php to convert the data back from string into binary data, but I cannot find it out. Ideas? On Sat, Aug 16, 2008 at 9:02 PM, Juan Pablo Califano

Re: [Flashcoders] Binary Data Question

2008-08-16 Thread Juan Pablo Califano
Maybe you don't have a version of amfphp that supports AS 3.0 objects... Check this out: http://www.sephiroth.it/tutorials/flashPHP/amfphp_bytearray/ On the other hand, if using amfphp is not a requirement, you could just use the class I posted, and handle things from the php side as if it were

Re: [Flashcoders] Binary Data Question

2008-08-15 Thread Glen Pike
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

Re: [Flashcoders] Binary Data Question

2008-08-15 Thread Omar Fouad
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

Re: [Flashcoders] Binary Data Question

2008-08-15 Thread Glen Pike
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

Re: [Flashcoders] Binary Data Question

2008-08-15 Thread Omar Fouad
I mean that You can save files to HDD now without using server side script with the new flash player 10. On Fri, Aug 15, 2008 at 6:16 PM, Glen Pike [EMAIL PROTECTED]wrote: Hi, You can't save an image from Flash without a server side script... Mario's example sends an image to the

Re: [Flashcoders] Binary Data Question

2008-08-15 Thread Omar Fouad
Glen, thanks for your help, I actually wanna store the Image in a mysql database and not uploading it somewhere in my server. On Fri, Aug 15, 2008 at 6:48 PM, Omar Fouad [EMAIL PROTECTED] wrote: I mean that You can save files to HDD now without using server side script with the new flash

Re: [Flashcoders] Binary Data Question

2008-08-15 Thread Juan Pablo Califano
With the newest player, I think, it's possible to save data into the USER's hard drive without a trip to the server, but you want to store the data on the server side, you need to send it to the server... You have to post that data using a URLLoader object, and specifying the input as binary

RE: [Flashcoders] Binary Data Question

2008-08-15 Thread Dave Watts
Glen, thanks for your help, I actually wanna store the Image in a mysql database and not uploading it somewhere in my server. You'll still need to upload it to your server first. Your server-side script can then send it to the database. Dave Watts, CTO, Fig Leaf Software

Re: [Flashcoders] Binary Data Question

2008-08-15 Thread Omar Fouad
I guess I can send the ByteArray to the php that will handle its insertion to the database. Right? On Fri, Aug 15, 2008 at 7:07 PM, Juan Pablo Califano [EMAIL PROTECTED] wrote: With the newest player, I think, it's possible to save data into the USER's hard drive without a trip to the server,

RE: [Flashcoders] Binary Data Question

2008-08-15 Thread Dave Watts
I guess I can send the ByteArray to the php that will handle its insertion to the database. Right? Yes, as long as your database drivers support that. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at

Re: [Flashcoders] Binary Data Question

2008-08-15 Thread Juan Pablo Califano
Yes. Using that particular class I mentioned, from the php side you'd receive the data like a regular html form post with multipart-encode, that means, you can retrieve the text variables you want to send with $_POST['someVar'] and the file (or files) with $_FILES['varName'] (or the name you

Re: [Flashcoders] Binary Data Question

2008-08-15 Thread Omar Fouad
Thanks.. I will try this now and feed you back. On Sat, Aug 16, 2008 at 1:41 AM, Juan Pablo Califano [EMAIL PROTECTED] wrote: Yes. Using that particular class I mentioned, from the php side you'd receive the data like a regular html form post with multipart-encode, that means, you can

[Flashcoders] Binary Data Question

2008-08-14 Thread Omar Fouad
Hello all, I was wondering if I can get the binary data from a bitmap data, and send it to database (blob) or/and getting the binary data from the database and in flash reform it to display the bitmap back. I've been reading about the ByteArray Class but I am still confused whether to use it or

Re: [Flashcoders] Binary Data Question

2008-08-14 Thread Juan Pablo Califano
You can use the getPixels() method of the BitmapData class to get the raw pixel data as a ByteArray. Using setPixels() you can fill a BitmapData object with data from a ByteArray. You can post / retrieve that data from a server using a URLRequest object, specifying that you want to use a binary

Re: [Flashcoders] Binary Data Question

2008-08-14 Thread Omar Fouad
You mean it is not the same bandwidith taken as when loading the picture from a directory in a server? On Thu, Aug 14, 2008 at 6:59 PM, Juan Pablo Califano [EMAIL PROTECTED] wrote: You can use the getPixels() method of the BitmapData class to get the raw pixel data as a ByteArray. Using

Re: [Flashcoders] Binary Data Question

2008-08-14 Thread Mark Winterhalder
On Thu, Aug 14, 2008 at 10:56 PM, Omar Fouad [EMAIL PROTECTED] wrote: You mean it is not the same bandwidith taken as when loading the picture from a directory in a server? It's a different encoding. You could encode it to, say, png before sending it back, or use zlib compression. Mark

Re: [Flashcoders] Binary Data Question

2008-08-14 Thread Juan Pablo Califano
Well, that depends on the picture, but yes, generaly you'd load a jpg, png, etc, which are compressed formats. For instance, right now I'm seeing a 466 x 468 jpg. Its size is 34 Kb. Bear in mind that the compression ratio varies depending on the actual image and the compression rate / algorithm

Re: [Flashcoders] Binary Data Question

2008-08-14 Thread H
Compress it to a PNG or a JPEG - these formats will output a tidy ByteArray for you. If you don't have AMF or trouble with writing HTTP Post headers, you can always pack it into a Base64 encoded string. Use Loader.loadBytes() to load it. This is in fact synchronous but occurs asynchronously. I