Revision: 5773
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at April 3, 2008 04:42 by gfazioli
Initial Code
/** ** @prototype : 0.0.1 ** @author : =undo= ** @email : [email protected] ** @web : http://www.undolog.com ** ** @params : ** ** __bitmap : puntatore alla nostra bitmap ** __width : larghezza in pixel ** __height : altezza in pixel ** */ // copia per la lettura - questo potrebbe essere evitato var sbmp:BitmapData = new BitmapData(__width, __height); sbmp.draw ( __bitmap ); // var pixels:Array = new Array(); for (var xx:uint = 0; xx <= __width; xx++) { for (var yy:uint = 0; yy <= __height; yy++) { pixels.push( sbmp.getPixel32(xx, yy).toString(16) ); } } // var urlreq:URLRequest = new URLRequest( "http://miodominio.com/savebitmap.php" ); var urlpar:URLVariables = new URLVariables(); var urlldr:URLLoader = new URLLoader(); // urlldr.addEventListener( Event.COMPLETE, function (e:Event):void { trace( ' Completato' ); } ); // urlpar.pixels = pixels.toString(); urlpar.height = __height; urlpar.width = __width; urlreq.data = urlpar; urlreq.method = URLRequestMethod.POST; urlldr.load( urlreq ); --- PHP --- /** ** @prototype : 0.0.1 ** @author : =undo= ** @email : [email protected] ** @web : http://www.undolog.com ** ** @params : ** ** __bitmap : puntatore alla nostra bitmap ** __width : larghezza in pixel ** __height : altezza in pixel ** */ // $pixels diventa un array con i valori dei singoli pixel $pixels = explode(",", $_POST['pixels']); $width = $_POST['width']; $height = $_POST['height']; // creo l'immagine - @evitando di emettere errori $image = @imagecreatetruecolor( $width ,$height ); // Scrivo i pixel per tutta la lunghezza e altezza $index = 0; for($x=0; $x<=$width; $x++){ for($y=0; $y<=$height; $y++){ $r = hexdec("0x".substr( $pixels[$index] , 2 , 2 )); $g = hexdec("0x".substr( $pixels[$index] , 4 , 2 )); $b = hexdec("0x".substr( $pixels[$index] , 6 , 2 )); $color = imagecolorallocate($image, $r, $g, $b); imagesetpixel ($image,$x,$y,$color); $index++; } } // scrivo immagine (in JPG - ma potete usare un diverso formato) sul disco/server imagejpeg( $image, "immagine.jpg" ); imagedestroy( $image ); // libero tutto
Initial URL
http://www.undolog.com/2008/03/31/come-salvare-immagini-in-flash-cs3/
Initial Description
This snipped is split in two sections: Actionescript 3 and PHP
Initial Title
Save JPG image from Flash CS3
Initial Tags
php
Initial Language
ActionScript 3