8 Replies Latest reply on Jan 25, 2008 9:28 AM by relief8

    Email image from flash

    relief8 Level 1
      I created an email form in my swf. It emails text from input fields. I want to also include an image with the text. Does anyone know how to do that?
        • 1. Re: Email image from flash
          niki tsanov
          You can use FileReference to upload image into the server and after that add into your mail script content-type text/html to show the image into message or you can attach to the mail.
          • 2. Re: Email image from flash
            relief8 Level 1
            hmmm, a little over my head I think. Can you give me a sample script of what it would look like. I am attaching bitmapData to moviclip "A". I want to email the bitmapData in movieclip "A".
            • 3. Re: Email image from flash
              niki tsanov Level 1
              So first you must use BitmapData to export the data from flash to some picture file with for example php is good.You can use BitmapData.draw(Target) and after that to store all the pixels into array and send to php there must generate new image file.I recommend to use POST method because the array of pixels is too long and when you dont have access to the php.ini file to change the max send data for get the server send errors.Okey now i stop to talk and i give you link to .fla file because is too long to explain.This file is my project that you can get picture from the camera and save into the server is simply application and i think you can understand the chifly idea.So when you create your application u must add some lines into php that send the picture and message to email. Link to fla. - http://www.nikis.org/BitmapData.Draw.zip
              The other way that i already say you is to upload file with FileReference LiveDocs FileReference.And afcource the php see in this site into comments very useful things about attachment and send via html PHP Mail() Function
              btw i forgot i have small problem with the colors sometimes the new saveed picture has more green color.But i think this can script can explain the idea :)
              • 4. Re: Email image from flash
                relief8 Level 1
                Hi, this is great. Can you tell me what you would change in the php file to make the image be emailed instead of being openned in another window?
                • 5. Re: Email image from flash
                  niki tsanov Level 1
                  Change the out.send(...) to out.sendAndLoad("send.php",out,"POST");
                  After that see the link about php mail() function how to send email via php and the end of the php script just put the mail code.Also if you want to save like random image names you must change ImageJPEG($image,"test.jpg");.
                  • 6. Re: Email image from flash
                    relief8 Level 1
                    Do you have a sample of this like you did for the other one? If not, that's ok. Thanks for your help.
                    • 7. Re: Email image from flash
                      niki tsanov Level 1
                      Into the example file i was sent you put into Save function() that
                      txtFrom, txtSubject and txtMessage is the TextFields into your Stage.Into your php put this lines in the end of the php file before ?>.So this is default file test.jpg i mean you can change to what you want but if you change into the $Message <img src....> you must change it and into ImageJPEG($image,"test.jpg");.Because the script first generate new image and after that send the image to email and into new email is show like on web not attachment.I mean show like Greeting card.After is send complete the script back the variable &Status that store the status of sended email True or False you can work with this variable into flash if you want to see some result like."Yeep the email is sended".And one more thing if you want you can add To email just change $myEmail to get the $_POS['To'].Here and the script that you must add into the end of php.
                      So i hope im usefull.And exusme for my explains but this language is not my favorite :) Cheers :)
                      • 8. Re: Email image from flash
                        relief8 Level 1
                        This is great. Thank you very much for all your help.