[EDIT : Take a look at this one instead :) ]
I had a fun last night building the application which allows user to edit images directly on the server. There are couple of options like color, hue, saturation... Why? Because the current project i am working on is Flex CMS with integrated web analytics and image editor - all in one. Man, it turns me on! Anyway...
If you wonder how to export valid jpg or png files form Flex, this is how you do that. First, you need to download as3corelib form Google Code........ And that's about it! :) Really, it's easy as that! In the as3corelib package, there are two classes used for image encoding: JPGEncoder and PNGEncoder.
If you are using Flex 3, you have built in classes mx.graphics.codec.JPEGEncoder and mx.graphics.codec.PNGEncoder. What these classes do is to convert BitmapData object to valid JPG or PNG as a ByteArray. Since i am using PHP all the time, i will explain how this works with PHP (the PHP is used only for decoding and for displaying the image).
I made a simple class to achieve that - you can download it from here and check the methods here(as3corelib is not included in the download).
What happens when you convert BitmapData to JPG? Well, you can't do anything with it if you do not know how to actually display ByteArray.
First, you will need to encode ByteArray with mx.utils.Base64Encoder and to decode that data on the server. This is where PHP comes with base64_decode function. And that's it. :) When you check the class i provided, you won't have to think about it and PHP code is included in the class too - just call tracePHP function.
Make shore you check the application i made for testing. There are a couple of images of my naked wife you can edit and save to your computer.
Yeah... dream on!
I had a fun last night building the application which allows user to edit images directly on the server. There are couple of options like color, hue, saturation... Why? Because the current project i am working on is Flex CMS with integrated web analytics and image editor - all in one. Man, it turns me on! Anyway...
If you wonder how to export valid jpg or png files form Flex, this is how you do that. First, you need to download as3corelib form Google Code........ And that's about it! :) Really, it's easy as that! In the as3corelib package, there are two classes used for image encoding: JPGEncoder and PNGEncoder.
If you are using Flex 3, you have built in classes mx.graphics.codec.JPEGEncoder and mx.graphics.codec.PNGEncoder. What these classes do is to convert BitmapData object to valid JPG or PNG as a ByteArray. Since i am using PHP all the time, i will explain how this works with PHP (the PHP is used only for decoding and for displaying the image).
I made a simple class to achieve that - you can download it from here and check the methods here(as3corelib is not included in the download).
What happens when you convert BitmapData to JPG? Well, you can't do anything with it if you do not know how to actually display ByteArray.
First, you will need to encode ByteArray with mx.utils.Base64Encoder and to decode that data on the server. This is where PHP comes with base64_decode function. And that's it. :) When you check the class i provided, you won't have to think about it and PHP code is included in the class too - just call tracePHP function.
Make shore you check the application i made for testing. There are a couple of images of my naked wife you can edit and save to your computer.
Yeah... dream on!
Really nice! and thanks for the tips.
ReplyDeleteIf you run into any performance issues with jpg encoding, try encoding as .png files. From my informal evaluation, the png encoder in the corelib is between 2-3 times faster than the jpg encoder.
ReplyDelete@Regis: Thanks! I am glad you like it! :)
ReplyDelete@Dusty: I agree with you that PNG encoder is faster than JPG encoder but think it is related with quality and size of data. Thanks on your comment!
Mirko, I really like the app. I would like to get started working with flex and creating some kind of photoalbum app but I have not been successful in finding example apps.
ReplyDeleteWould there be a chance that you can post the code, or maybe you know of some helpful links for me?
Most of your links are broken.
ReplyDelete@tony: I will publish the source - give me one day or so... But if you are just about to start with Flex, then you will need to take a book and read it (i know how hard this can be). If you don't know anything about developing Flex applications, take this one: The Essential Guide to Flex 2. In this book you wont find some detailed explanations of what is going in the background but for the start, it's more than enough. If you are looking for more advanced examples and more detailed explanations, read this one:Programming Flex 2. Hope it helps.
ReplyDelete@David: It's fixed! Thanks for letting me know! candymandesign.com will be down for couple of days so i changed the paths. Thanks again!
Great! thanks for the links/books. I will pass by the book store later on tonight and pick them up.
ReplyDeleteI already know how to develop in AS2 & 3 but in Flash, but I am not familiar with the Flex IDE and mxml. The essential guide you mention looks like will explain these things to me. I'll see if my book store has both of these books.
good,I also do this these days.
ReplyDeletecan you send me a source code ?
shitou2000ks@sina.com
thanks.
hi,candymandesign: i'm doing somework on image edit with flex3 then could you send me the source? i really need it,please , thank you very much :)
ReplyDeletemy Email is cwmiss@163.com
ReplyDeletehi,this is really a nice example.can u send me the code of colourized image.plz its urgent.
ReplyDeleteMy mail id is:
priyanka.evolko@gmail.com
Hi, I am new to Flex, and want to build an online image editor, so can you send me a copy of your source code to me to learn? Here is my email: larrywo@gmail.com
ReplyDeleteThanks ahead!
this is really a nice example,could you send me the source?
ReplyDeletemy Email is yssj@tom.com
Nice tips...!
ReplyDeleteCan you send me source i really need.
Myid: pdpatel85@gmail.com
Thanx in Advance.
Hi,This is really very stanging and helpful for every flex programmer and developer.I have need of this so please send me source code of this one.
ReplyDeleteajaykymca@in.com
Thanks alot
Really nice application and also iam in a great need of it, i tried but iam unable to paint on the loaded image can you please send me the source to rajveerg@gmail.com.
ReplyDeleteHi,
ReplyDeleteThat's very great sample for me. If possible,please send the source to ccmm18@hotmail.com.
Thanks a lot.
Really nice application and also iam in a great need of it, i tried but iam unable to do.can you please send me the source to .
ReplyDeletesujit271983@gmail.com
This comment has been removed by the author.
ReplyDeleteDear Mirko,
ReplyDeleteI am amazed with your example, please us know where we can download the sourcecode, i did a right click to viewsource but its not there.
I hope your example ll help many flexians who are learning :-)
Please let me know the sourcecode my mail id is suresh.sci@gmail.com
Could you send me the source code.
ReplyDeleteThank you,
Christophe_jacquelin@yahoo.fr
Great, Great Example,
ReplyDeletePlease, Please could you send me the source code.
Thank you
level42@flashwerk.net
Hi,
ReplyDeleteIt's very great sample for me.
If possible,please send the source
code ^^
ksddugi@nate.com
Thank you very much ^^
Could You please send me the spurce code of this app ?
ReplyDeleteBest regards
my email: howlingsun@gmail.com
Hi, nice work :) Please, send me source code ... sandi.krese@gmail.com
ReplyDeleteBest regards
Sandi
Hi,This is really very good and helpful for every flex programmer and developer.I hope your example will help many developer who are learning.
ReplyDeletePlease let me know the source code my mail id is:
mahehasan@yahoo.com
the download link is broken, can I have your source code and check its super functionality?
ReplyDeleteYou will publish the code ? or not?
ReplyDeleteTell us plz! =)
Hello, can I get source code of this app?
ReplyDeleterouslan.tairov@gmail.com
Thanx
hello, i have similar requirement , please can u send me the code to my id
ReplyDeletevarunvittal@yahoo.co.in
女性会員様増加につき、当サイトの出張ホストが不足中です。女性の自宅やホテルに出向き、欲望を満たすお手伝いをしてくれる男性アルバイトをただいま募集していますので、興味のある方はTOPページから無料登録をお願いいたします
ReplyDelete最近様々なメディアで紹介されている家出掲示板では、全国各地のネットカフェ等を泊り歩いている家出少女のメッセージが多数書き込みされています。彼女たちはお金がないので掲示板で知り合った男性とすぐに遊びに行くようです。あなたも書き込みに返事を返してみませんか
ReplyDeleteオ○ニーライフのお手伝い、救援部でHな見せたがり女性からエロ写メ、ムービーをゲットしよう!近所の女の子なら実際に合ってHな事ができちゃうかも!?夏で開放的になっている女の子と遊んじゃおう
ReplyDeleteplease help, I really need in this example, please send to tanship@mail.ru, thanks a lot
ReplyDeletemirko
ReplyDeletethis example sounds amazing and I would really benefit from it. please send me a cope of the source code to
shadw.hunter [at] gmail.com
thanks so much!!
thanks for this stunning example. I would be very pleased if you could post the source code or mail it to webmaster@das-tier.de
ReplyDeleteThank you very much!
Did you ever post up the entire code sample or just the pieces?
ReplyDeleteHello.
ReplyDeleteEver wanted to add a way to the user choose the area of the image that will edited, like the lasso tool in photoshop?
The source of this application is available? Where?
Grateful for the attention
thanks for this great example. I would be very pleased if you could post the source code or mail it to ershovdz@gmail.com
ReplyDeleteThank you very much!
Very cool! Do you think you could email me the source to work@JohnLeavitt.net ? I would love to analyze it at length, thanks in advance....cool article...John
ReplyDeleteHI
ReplyDeleteI really liked your Photo Editor package. I wanted to know whether can i download and integrate the same in to my website. Is it an Opensource? Please let me know your reply,
Thanks
@Candyman - Good morning sir! I'm wondering if you ever released source for this sample app? I am writing one myself but ran into a brick wall on how to do certain image manipulations, and your sample would really help me! Just in case you only email it out, could you please send it here: spamdam (at) gmail (dot) com
ReplyDeleteI really appreciate you sharing with the community!!!
@ Candyman. Was looking for some image editing tips online and I came across this site.
ReplyDeleteI trying to replicate this example to but am running into brick walls.
I possible I would really appreciate if you could email the code to davykiash{@}gmail{dot}com
Thanks for sharing this with the community.
Nice image tool.
ReplyDeleteAmazing !!!!!!!!
Could you send me code at deepak.joshi at truworthit.com
Thanks in advance
hello,Mirko.
ReplyDeleteI'v encountered a problem about use
multiple filter for the same picture, could you give me some advice? or can you send the souce code about this ?
my email is holmes2136@gmail.com
thanks a lot
http://www.imagedream.biz
ReplyDeletefotografo matrimonio :-Imagedream offrire servizio fotografico including www.imagedream.biz, foto matrimoni, foto battesimi, book fotografici, foto turisti servizi. Il nostro obiettivo é quello di creare splendide cornici,cornici che raccontano una storia dall’inizio alla fine. Garantiamo che riceverete servizi di qualità,con il massimo impegno e professionalità,in tutto ciò che riguarda il servizio fotografico
-