I want to save an image from an URL to the user's local machine in PHP. Is this possible? I've been researching for a while, and I can't seem to find the answer. This is my code
function Save()
{
header('Content-Type: image/png');
header('Content-Disposition: attachment; filename="thumbnail.png"');
imagepng("url?");
}
If there is a download link that the user clicks on, you can have it re-direct to the url of the file you want to serve directly, the client browser should handle the rest.
If the file needs to be re-served from your system having a php file that sets those headers and then echo's the imagepng output should do it.