Skip to main content
July 16, 2007
Question

flash as3.0 screen shot with php

  • July 16, 2007
  • 37 replies
  • 4382 views
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

This topic has been closed for replies.

37 replies

Inspiring
July 23, 2007
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 URLRequest from flash).

You mentioned you use Coldfusion already ... so do you know how to do that?
Inspiring
July 20, 2007
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.
Inspiring
July 20, 2007
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



July 20, 2007
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
July 20, 2007
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?
kglad
Community Expert
Community Expert
July 20, 2007
and it's a flash class. but i still don't know who wrote it.
July 19, 2007
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.
kglad
Community Expert
Community Expert
July 19, 2007
it's a php class written by person(s) unknown to me.
Inspiring
July 20, 2007
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
kglad
Community Expert
Community Expert
July 18, 2007
what's asfiles.encoding.JPEGEncoder?
July 18, 2007
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?
kglad
Community Expert
Community Expert
July 17, 2007
why are you using POST to send your data and GET to retrieve name?
July 17, 2007
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?
Inspiring
July 17, 2007
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.