# Help commenting this code

**URL:** <https://forum.kirupa.com/t/help-commenting-this-code/257117>\
**Category:** flash\
**Created:** [April 10, 2008, 12:33pm UTC](https://forum.kirupa.com/t/help-commenting-this-code/257117 "2008-04-10T12:33:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ma501th](https://avatars.discourse-cdn.com/v4/letter/m/858c86/32.png) [@ma501th](https://forum.kirupa.com/u/ma501th)\
**Post date:** [April 10, 2008, 12:33pm UTC](https://forum.kirupa.com/t/help-commenting-this-code/257117/1 "2008-04-10T12:33:02Z")

</div>

Hi.  
I need help commenting these peice of coding if possible. The code below saves the image and sends it across to save.php file to display on a sperate browser.

import flash.display.BitmapData;  
shaF.onPress = function() {  
output();  
};  
function output() {  
snap = new BitmapData(mc.\_width, mc.\_height);  
snap.draw(mc);

```
var pixels:Array = new Array();
var w:Number = snap.width;
var h:Number = snap.height;
for (var a = 0; a&lt;=w; a++) {
    for (var b = 0; b&lt;=h; b++) {
        var tmp = snap.getPixel(a, b).toString(16);
        pixels.push(tmp);
    }
}
var output:LoadVars = new LoadVars();
output.img = pixels.toString();
output.height = h;
output.width = w;
output.send("save.php", "output", "POST");

```

}  
stop();

I also need the save.php coding below to be commented please if possible:

\<?php  
$data = explode(",", $\_POST[‘img’]);  
$width = $\_POST[‘width’];  
$height = $\_POST[‘height’];  
$image=imagecreatetruecolor( $width ,$height );  
$background = imagecolorallocate( $image ,0 , 0 , 0 );  
//Copy pixels  
$i = 0;  
for($x=0; $x\<=$width; $x++){  
for($y=0; $y\<=$height; $y++){  
$int = hexdec($data[$i++]);  
$color = ImageColorAllocate ($image, 0xFF & ($int \>\> 0x10), 0xFF & ($int \>\> 0x8), 0xFF & $int);  
imagesetpixel ( $image , $x , $y , $color );  
}  
}  
//Output image and clean  
header( “Content-type: image/jpeg” );  
ImageJPEG( $image );  
imagedestroy( $image );  
?\>

cheers for your help
