views:

198

answers:

2

I am building a Flash AS3 application that allows users to modify images, and then submit-save them to a server. The user will then have the ability to log in and access these saved images in a thumbnail gallery. They can either delete an image or click a thumbnail to view it at original size.

I am comfortable with the front end having built something similar in AS2 and Flash 8 a few years back. What will be required for the backend? I assume some type of PHP-MySQL database is needed. Not sure about hosting issues requirements as the AS2 application I built never sent any actual binary data, but rather data describing the image transformations. I assume I will need to make use of byteArray?

Is there an existing tutorial or code sample that does something similar available for viewing-download?

Are there any security restriction 'gotchas' associated with FP9 -10 I need to be aware of?

Any suggestions feedback appreciated!

A: 

If you are on a shared host, php and mysql are probably already available to you, that is a good way to get started.

In terms of flash communicating with the server, you will have to find a way to turn your pictures into a stream of bytes (byteArray sure), and then use flash's send() to post them to the server. Sending XML Out From Flash

Using php you can receive the images and save them to the db, and show them (turn the stream of bytes back into an image with gd -- gd docs)

Also: you may not ever have to send a stream of bytes if you can find a way to have flash describe the transformations, and have gd repeat them, just a thought.

Are there any security restriction 'gotchas' associated with FP9 -10 I need to be aware of?

Maybe, if you are posting data to a different server, you have to enable it with some xml Send data from Flash to PHP on a different server

asperous.us
+1  A: 

the most simple way is to create the image in the client ... get a BitmapData snapshot of the image using BitmapData::draw ... convert this to JPEG or PNG using the as3corelib, that offers encoders for both formats ... and then just send the raw binary data to the server (store it into the data property of your URLRequest) and there, store it to the file system (retrieve it in $HTTP_RAW_POST_DATA) ... so the whole storage process is just a couple of lines ...

you will need a database of course, for session management (you could rely on PHPSESSION only, but personally i don't trust it), login, registration and to store which image belongs to which user ...

so yeah, the whole netcode/backend/storage thing etc. will be quite a piece of cake (btw. you might wanna look into amfphp) ... designing a good interface and implementing the galery view etc. will be the biggest chunk i guess ...

there are no real security gotchas, as long as your SWF comes from the same server, that it communicates to ...

so good luck then ... ;)

back2dos