The Little Guy Posted December 12, 2010 Share Posted December 12, 2010 I am sending a jpg from ActionScript as post data, and I am not sure if my php is wrong. The jpg is a string of data, but it isn't all getting put into the jpg file. I have written it to a txt file, and the output was about 6 characters. Will my PHP work? The ActionScript: private function saveImage(e:MouseEvent):void{ byteArray = jpg.encode(bmd); //fileReference.save(byteArray, "Image.jpg"); var request = new URLRequest("http://envne.com/process/saveImage.php"); request.method = URLRequestMethod.POST var vars = new URLVariables(); vars.img = byteArray; //vars.txt = 'hello!'; request.data = vars; var loader = new URLLoader(); loader.load(request); removeChild(bmp); save.visible = false; discard.visible = false; capture.visible = true; } The PHP: <?php $handle = fopen('test.jpg', 'w'); fwrite($handle, $_POST['img']); fclose($handle); ?> Quote Link to comment Share on other sites More sharing options...
Buddski Posted December 12, 2010 Share Posted December 12, 2010 Have a look at this http://php.net/manual/en/function.imagecreatefromstring.php Not too sure as to why its only outputting 6 characters.. Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted December 12, 2010 Author Share Posted December 12, 2010 I have gotten it to display more lines, but I can not view the image in the browser though... ÿ6+ÿ4)ÿ4(ÿ4(ÿ<%"ÿ@*&ÿ:*ÿ;+ÿ8-ÿ9.ÿ:-ÿ:-ÿ=-ÿ=-ÿ?0ÿA2ÿ?0ÿA2ÿE/ ÿD.ÿA/!ÿC1#ÿ?2 ÿ@3!ÿ?4!ÿ@5"ÿ?4!ÿA6#ÿF6*ÿE5(ÿH5,ÿJ7.ÿH7+ÿI9,ÿH;-ÿI<.ÿI<.ÿL>0ÿQB.ÿVG3ÿUD.ÿUD.ÿTE1ÿWH4ÿ]J7ÿ`L:ÿ`J:ÿeN?ÿgOHÿlTLÿmXJÿt_QÿucUÿygXÿ|l]ÿ|l]ÿ‚ofÿ†siÿŽvlÿŒukÿÂ�zlÿÂ�zlÿ‹zrÿŒ{sÿ‰{rÿŒ}uÿÂ�}sÿÂ�~tÿŽ‚tÿŽ‚tÿ’ŽÿŠ†wÿ‹~zÿ‹~zÿŒ}yÿÂ�€|ÿ‹‚uÿ‹‚uÿ‰ƒsÿ‰ƒsÿ‰ƒsÿ‰ƒsÿ‰‚uÿˆÂ�tÿŠ€tÿŠ€tÿŠÂ�rÿ‹‚sÿÂ�€nÿ–‰w󧖅󾬛ÿ×Ã�«ÿìÖÀÿîںÿò޾ÿûçÇÿûçÇÿùäÀÿøâ¾ÿýçÃ�ÿÿÃÇÿüéÄÿýêÅÿýéÉÿûçÇÿ÷äÂÿõâ¿ÿþîÆÿÿôÌÿÿîËÿýìÉÿÿëÎÿÿëÎÿÿéÑÿÿéÑÿÿèÑÿÿçÃ�ÿÿçËÿÿéÃ�ÿÿéËÿÿëÃ�ÿÿîËÿÿêÇÿÿìÄÿÿìÄÿÿì¹ÿÿð¾ÿÿôÉÿÿôÉÿÿóÃ�ÿÿòÎÿÿóÃ�ÿÿòÎÿÿïÃ�ÿÿïÃ�ÿÿïÃ�ÿÿðÒÿÿòÎÿÿïËÿÿÿáÿÿÿãÿøêÃÿÞЩó¹¦�ÿ~kGÿlV@ÿ_J3ÿH7!ÿA0ÿ>-ÿ>-ÿ<+ÿ<+ÿ;+ÿ:*ÿ6(ÿ5&ÿ/#ÿ+ÿ%ÿ%ÿÿÿÿ"ÿ"ÿ#ÿ%ÿ$ÿ' ÿ* ÿ' ÿ(ÿ*ÿ+ ÿ*!ÿ,#ÿ,#ÿ.%ÿ-'ÿ1+ÿ3-ÿ70 ÿ;2!ÿ>6$ÿC9&ÿH=*ÿL</ÿRB5ÿUH8ÿYK;ÿ[O8ÿ]Q:ÿ\S6ÿ`W;ÿa[;ÿe^>ÿocIÿocIÿudSÿweTÿxiXÿxiXÿwkQÿzoUÿyqOÿ{sQÿ~tNÿ|rLÿÂ�mMÿÂ�mMÿ~gJÿÂ�kNÿ{gPÿxeNÿ{gTÿ|hVÿ{gTÿyeSÿyfOÿxeNÿ}jQÿubIÿteQÿaR>ÿ81ÿ.&ÿÿÿÿ ÿ Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted December 12, 2010 Author Share Posted December 12, 2010 When I try to convert it using ImageMagick I get: convert: Improper image header `test.bmp'. convert: missing an image filename `test.jpg'. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.