Saving images from flash to server using PHP

zzxxccww

New Member
I am trying to save some images from Flash to Php by sending a jpgstream, capturing it in php and pushing it to a file. Not sure what I am doing wrong here.I am putting all the images I need into an array like so: (history is just where I am keeping all the image data)\[code\]for each($value in history) { var jpgSource:BitmapData = http://stackoverflow.com/questions/3825085/new BitmapData ($value.sourceImg.width, $value.sourceImg.height); jpgSource.draw($value.sourceImg); var encoder:JPEGEncoder = new JPEGEncoder(100); var jpgStream:ByteArray = encoder.encode(jpgSource); var imgDetailArr:Array = new Array(jpgStream, $value.name); imgArr.push(imgDetailArr); }\[/code\]And then i send that to PHP using a remote object and amfphp:\[code\]rmObj.saveUserImages( imgArr);\[/code\]On the php side I am doing this:\[code\]function saveUserImages( $imgArr) { foreach($imgArr as $value) { ob_start(); /* output image as JPEG */ $image = imagecreatefromjpeg($value[0]); header('Content-type: image/jpeg'); imagejpeg( $image ); /* save output as file */ ob_flush(); file_put_contents( "images", ob_get_contents() ); } }\[/code\]But this doesn't seem to do the trick. I have been going through a bunch of different tutes and code snippets, so maybe I just ogt something confused along the way. I have done this before though and don't remember it being this difficult.
 
Back
Top