1 2 Previous Next 45 Replies Latest reply on Jul 27, 2007 11:18 AM by C-Rock

    flash as3.0 screen shot with php

    C-Rock Level 2
      hello, i'm so close to actually getting this to work and i'm breaking down and asking for some help. here is my actionscript and php codes, why doesn't this work?

      the link for a preview and the error:
      Link here

        • 1. Re: flash as3.0 screen shot with php
          C-Rock Level 2
          and the php...

          • 2. Re: flash as3.0 screen shot with php
            C-Rock Level 2
            anyone know anything about this????
            • 3. Re: flash as3.0 screen shot with php
              Greg Dove Level 4
              I don't know anything about it, sorry.

              I know PHP 5.2.2 has problems with $GLOBALS["HTTP_RAW_POST_DATA"]

              This wasn't a problem in 5.2.1 and is apparently fixed in 5.2.3. There are also simple workarounds posted if that's related.

              I took a quick look at the link you posted. Firefox showed me the request for create.php returned a page not found response:
              http://www.richardson-graphics.com/testJpegSave/create.php?name=snapshot.jpg

              Perhaps that helps, perhaps not. Good luck.
              • 4. Re: flash as3.0 screen shot with php
                Damon Edwards Level 3
                i can see the page in firefox, however, I do receive this error

                Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. URL: create.php?name=snapshot.jpg
                at finalSave_fla::MainTimeline/finalSave_fla::frame1()
                • 5. Re: flash as3.0 screen shot with php
                  kglad Adobe Community Professional & MVP
                  i made an application that worked fine using mario klingemann's bitmapexporter class:

                  www.quasimondo.com
                  • 6. Re: flash as3.0 screen shot with php
                    C-Rock Level 2
                    the www.quasimondo.com is very slow and i tried it already. it uses as2.0 and sends the data over a connection usually giving the flash player is running slow click here to abort message.

                    i did find someone using it in as3.0 and used most of there code, however i couldn't even re-use their files to re-create their video capture.

                    mine is much simplier than a video screen shot. i just want to take a movie clip and save it's "screen shot" to a jpeg. as3.0 allows you to do this much faster.
                    • 7. Re: flash as3.0 screen shot with php
                      C-Rock Level 2
                      http://www.bytearray.org/wp-content/uploads/2007/04/jpeg_encoder_amfphp/

                      there is the link of it in action. for screen shots of high quality it is very fast. i can make it save to the disk locally, but never save to the server?
                      • 8. Re: flash as3.0 screen shot with php
                        Greg Dove Level 4
                        Did you see my earlier post.. and dzedward's? Your php script does not appear to be accessible.

                        If you click on the link:
                        http://www.richardson-graphics.com/testJpegSave/create.php?name=snapshot.jpg

                        Then I believe you should see:

                        result=An error occured.

                        In your browser window. But instead you get a 404 page not found.
                        • 9. Re: flash as3.0 screen shot with php
                          C-Rock Level 2
                          mmmm, that's crazy, i clicked the link as well and got the same thing but it's there? what's a reason you it wouldn't work?
                          • 10. Re: flash as3.0 screen shot with php
                            Greg Dove Level 4
                            I don't know. I'm only starting to learn the server-side stuff. And I think you're using PHP with IIS ...right? If so do you have other PHP scripts working... i.e. is it enabled... or is it some sort of security setting e.g. like .htaccess for apache (I have no idea about IIS - if that's what you're using).

                            But if I put your code on a test page and run in on my local apache/php server it works as it should (i.e. it displays in the browser: result=An error occured). So I think that's the problem that you need to fix.
                            • 11. Re: flash as3.0 screen shot with php
                              kglad Adobe Community Professional & MVP
                              why are you using POST to send your data and GET to retrieve name?
                              • 12. Re: flash as3.0 screen shot with php
                                C-Rock Level 2
                                not sure, like i said i used the source code files and tried to delete the code i didn't need an made it simplier....

                                can other people get this to work?
                                • 13. Re: flash as3.0 screen shot with php
                                  kglad Adobe Community Professional & MVP
                                  what's asfiles.encoding.JPEGEncoder?
                                  • 14. Re: flash as3.0 screen shot with php
                                    C-Rock Level 2
                                    i'm pretty sure it's the JpegEncoder class that is with AS 3.0 or the same one floating around the net that everyone uses.
                                    • 15. Re: flash as3.0 screen shot with php
                                      kglad Adobe Community Professional & MVP
                                      it's a php class written by person(s) unknown to me.
                                      • 16. Re: flash as3.0 screen shot with php
                                        kglad Adobe Community Professional & MVP
                                        and it's a flash class. but i still don't know who wrote it.
                                        • 17. Re: flash as3.0 screen shot with php
                                          Greg Dove Level 4
                                          I think it originated here (the 2005 dating on this strikes me as unusual though):

                                          (not sure)

                                          http://www.kaourantin.net/2005/10/more-fun-with-image-formats-in-as3.html
                                          • 18. Re: flash as3.0 screen shot with php
                                            C-Rock Level 2
                                            the code came from this site, along with the demo...

                                            http://www.bytearray.org/?p=90

                                            i can provide the AS document if you'd like.

                                            would it be possible just to use Coldfusion to replace the PHP code?
                                            • 19. Re: flash as3.0 screen shot with php
                                              Greg Dove Level 4
                                              I think the JPEGEncoder class originally came from the other source (I'm not 100% sure but the code is basically identical - there are comments to the effect that a few tweaks have been made). No issue with that though.

                                              What the bytearray implementation does is implement the uploading/saving support .

                                              The implementation at bytearray was done using amfphp (flash remoting with php) with amf3 encoding format.

                                              I presumed you were trying to avoid using amfphp remoting and just transfer the jpeg data in a binary format in your POST method upload. I presume that might work given that you can do binary transfers using as3... although I've never tried it.

                                              But the issue earlier appeared to be that your php script wasn't accessible which is (I believe) an issue unrelated to any of the code and something to do with how your server is set up. (I didn't delve too much into the code yet, because I can't see how it can work at all unless this is addressed first).

                                              Do you have PHP set up on your server? I assumed earlier that you had and that there was some other problem. If you don't have php set up then no php code will run. If you do have it set up then the problem is (I believe) something to do with how things are set up on your server (as long as the create.php file is in the same directory as the html).

                                              Coldfusion has (or used to have when I used it some years back) flash remoting support built in.

                                              But I guess if you can send the jpeg binary data directly via POST you don't need remoting.

                                              If I get time over the weekend I'll see if I can get it working the way you're trying to do it. (My first inclination would be to try to use amfphp and just replicate the bytearray example, but I'm also interested to see if it can work your way). Unless someone beats me to it. ;)

                                              GWD



                                              • 20. Re: flash as3.0 screen shot with php
                                                C-Rock Level 2
                                                GWD,

                                                Thanks for all your help. You are clearing up a lot for me. I'm pretty good with Flash but not with other languages.

                                                There actually was a problem with my server, my hosting company was to set-up Coldfusion on a Linux server and enable Flash Remoting, which is what I use for every site I do, basically.

                                                However when we were having the normal "linux / coldfusion" problems they switched me to a windows server and my Flash Remoting worked fine. They did this on 4 sites. I didn't notice because I don't use anything other than Flash, MySQL and Coldfusion. So it turns out I never noticed.

                                                I asked them to switch but then changed my mind. If windows is less buggy with Coldfusion and Flash Remoting I'll just stick with it for the site I'm needing to save the Jpeg on. If the code is just saving the jpeg then the optimal solution would be to just have the coldfusion document save the jpeg.

                                                I would be willing to pay you for helping, I will be using this code in the end for commercial purposes.

                                                If you're curious at all to what it's being used for check out this link:

                                                RGDevelopment1.com

                                                Go to the design page, click napkins, design up a napkin if you'd like. This site is still in development stage, obviously. I would like to take a jpeg of the designed item and save it, so that it can be email and used for other purposed, i.e. printing guide, later in the process.

                                                Thanks again for all your help, much much appreciated!

                                                Carey
                                                • 21. Re: flash as3.0 screen shot with php
                                                  Greg Dove Level 4
                                                  The site looks great. And a brilliant match between business opportunity and technology.

                                                  quote:

                                                  I would be willing to pay you for helping, I will be using this code in the end for commercial purposes.


                                                  No need. Few reasons:
                                                  a) I'm kinda new on the server-side stuff too...if I help out here I get to learn too.
                                                  b) I have a copy of Coldfusion (7) somewhere but I'm focusing on php so I'll check it via php (as per your example code) and/or amfphp if that doesn't work.
                                                  c) I'm just starting to set up my business and haven't charged anybody anything yet. Ever. lol.
                                                  • 22. Re: flash as3.0 screen shot with php
                                                    Greg Dove Level 4
                                                    OK... so I tried it this morning (Monday) . It works with PHP - no problems (there will be a problem with PHP 5.2.2 but like I said in an early reply that can be overcome).

                                                    With what you have everything works as it should already using php. Remoting is not required. Its great being able to do binary transfers like that. I don't know what the limit is for POST data sizes (or if there is one) but it makes doing something like this really easy. I must start using as3 more!

                                                    So if you don't have php but you do have coldfusion or IIS/asp then all you need to do is change the receiving script to the equivalent coldfusion (and the corresponding create.php URLRequ