Setting resized image to be downloaded

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
it2051229
Forum Contributor
Posts: 312
Joined: Tue Dec 25, 2007 8:34 pm

Setting resized image to be downloaded

Post 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.
User avatar
greyhoundcode
Forum Regular
Posts: 613
Joined: Mon Feb 11, 2008 4:22 am

Re: Setting resized image to be downloaded

Post 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'
Post Reply