Hi, all; My first post here.

I want to offer my users the ability to click on an icon, and download the hi-res version of the related image. Since I already have the album set up to show a screen-resolution image, there is no need to show it at print resolution hence I want to avoid going through the right click/save as routine.

I am using php on the server side, so I have plenty of flexibility to modify headers, etc.

Trouble is, I can't think of how to do it, so any help is greatly appreciated.

Peter

saveimage.php

<?php if(!$file) return false;
header("Content-disposition: attachment; filename=$file");
header('Content-type: image/jpeg;');
readfile("$file");
?>

image link

<a href='saveimage.php?file=hires/image.jpg'><img src='lowres/image.jpg' alt='click to save hires image'></a>

cool.
Thanks for that.
Peter

Generic file download
savefile.php

<?php 
if(!$file) return false;
if(!type) return false;
header("content-disposition: attachment; filename=$file");
header("content-type: $type");
readfile("$file");?>

download link

<a href='savefilee.php?file=pathtofile&type=type'>save this file</a>
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.