Page 1 of 1

Setting resized image to be downloaded

Posted: Mon Sep 01, 2008 2:59 am
by it2051229
I have created a simple php application that resizes pics.. so this is how the program goes, the server will provide the client an interface where to browse a picture, then after the client chose the pic to be resized it hits on the "RESIZE BUTTON" then the image goes to the server and the server resizes the picture then stores it in a temporary directory.. now the problem is how to set the server to send the resized pic to the client to download.

Re: Setting resized image to be downloaded

Posted: Mon Sep 01, 2008 3:47 am
by greyhoundcode
Redirect them to a PHP page which exists purely to serve the image:

Code: Select all

header('Content-Type: image/jpeg');
readfile('/filepath/resized_image.jpg');
They can then right click it and select 'Save image as'