You can try to set the file name using HTTP headers, but not all browsers respect this.
The easiest trick is to extend the URL so that the last part contains the desired file name:
<img src="picture_generator.php/desiredfilename.jpg?image_id=5&extension=.png&name=desiredfilename.jpg">
Note. I also added the file name at the end of the query line (the value of name really doesn't matter), as some browsers use this part.
Depending on the configuration of your server, this will immediately work without any special configuration (without mod_rewrite or anything like that). You can check if it works on your server by simply adding " /foo " to any PHP URL on your site. If you see the output of your PHP, all is well. If you see a 404 error, then your server configuration cannot handle such URLs.
Udo g
source share