hi all,

i have a php generated image that i want users to download as png, but as it is generated on the fly, the default save as option is <php_name>.php

so i just want to ask if there is any way to change this default file name to a png, without saving the image to server, as i have many users accessing the function at any time of the day.

thanks,
soya

Recommended Answers

All 4 Replies

hi,

for the displaying page, the line is simply:

<html>
//headers, etc
<?php
<img src="img.php?input=$value" border=0 />
?>
//footer
</html>

and img.php

<?php
    $image = ImageCreateFromPNG("base.png");
    //add user content
    header("Content-Type: image/PNG");
    ImagePng($image);
    imagedestroy($image);
?>

perhaps i should add that i can see the image with no problem. it is just the 'save image as' that i need some pointers on.

Use

header("Content-Disposition: attachment; filename=p1.png");

thank you kind sir


regards,
soya

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.