# Need Download Image button!

**URL:** <https://forum.kirupa.com/t/need-download-image-button/314696>\
**Category:** programming\
**Created:** [October 6, 2010, 1:31pm UTC](https://forum.kirupa.com/t/need-download-image-button/314696 "2010-10-06T13:31:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dreamgal](https://avatars.discourse-cdn.com/v4/letter/d/0ea827/32.png) [@dreamgal](https://forum.kirupa.com/u/dreamgal)\
**Post date:** [October 6, 2010, 1:31pm UTC](https://forum.kirupa.com/t/need-download-image-button/314696/1 "2010-10-06T13:31:39Z")

</div>

Hi,

I am exporting a jpeg image from flash (using bitmapExporter) and it is generating the image on a PHP page. The user can right-click and save that image to their computer.

I am looking for a PHP download button that could allow the user to download that image to their local disk from PHP page instead of right-click save.

Please any help/tutorial for this??

here is the link for my page (the first button)  
[http://www.sketchsa.com/persil2/index.html](http://www.sketchsa.com/persil2/index.html)

here is my current PHP script (show.php)

```php
<?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 );    
?>

```
