SWF 2 JPG

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Slippy
Forum Contributor
Posts: 113
Joined: Sat Jul 12, 2003 11:31 pm
Location: Vancouver eh!

SWF 2 JPG

Post by Slippy »

Help!

I am trying to write some PHP code that will allow me to import an image into flash (swf), rotate it, change the colour and position and then export a JPG based on what the user has selected.

Apparently this isn't that easy. I can get the jpg's into FLASH no problem; it's the exporting a JPG that seems to be problematic. Anybody have any ideas as to which road I should take on this one?

At present I am thinking that I will have to HTTP POST the location, name, size, color attributes of the jpg to PHP (using actionscript) and then try to duplicate the image using the built in PHP GDLib or ImageMagik functions.

It doesn't necessarily have to be a JPG... PNG would work well too.
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

I confused as to where flash comes into it, maybe you could clarify.
If it wasn't for the importing into flash then you wouldn't have a problem as PHP has ways of doing all the image manipulation.
jakobdoppler
Forum Commoner
Posts: 46
Joined: Wed May 21, 2003 6:16 pm

Post by jakobdoppler »

I confused as to where flash comes into it, maybe you could clarify.
I think what he is trying to do, is building some flash GUI for simple Image manipulation. U can use AS functions to translate, rotate or change some channel color of the movieclips containing loaded .jpgs. I don't think there is a possibility yet in Flash to manipulate single pixel values , but if you only want these few simple operations it should work fine, just to recieve the parameter (e.g. rotation angle, scale) in AS, process them to PHP and use them in GDLib.

But this is rather a problem of PHP AS interaction capabilities as a whole.
I once successfully communicated between Flash and mySql via phpScripts as gateway. I'd have a look at AS loadVars object, that is quite simple to use. For a higher quality approach on flash remoting, you might wanna try http://www.amfphp.org (makes use of php classes and their transference to flash)

related info
- loadVars on http://www.actionscript-toolbox.com
- there you might get better help on AS and flash issues http://www.flashkit.com/board
User avatar
Slippy
Forum Contributor
Posts: 113
Joined: Sat Jul 12, 2003 11:31 pm
Location: Vancouver eh!

Post by Slippy »

I eventually figured out how to do this... here is one way with PHP scripts (and MING ;)) http://jerryscript.hostrocket.com/flash ... 2JPEG.html

I wanted to do something a little bit different. I imported the image into flash with PHP as a bridge on the server side. The user then messes around with colours and moves the image around. When everything is said and done, I exported all of the information back to PHP and then basically duplicated the users choices using GDLib functions.

Worked pretty good; unfortunately the client realized that their business model was inherently flawed so the project has been scrapped. C'est la vie.

Thanks for the comment(s).
Post Reply