I am displaying the images through the Apache server.
When I click on each image it should open download.php?fiel=file_name.jpg and download the image to the system.
This is the code for Image Display
<?php
$files = glob("Image/"."*.*");
for ($i=0; $i<count($files); $i++)
{
$num = $files[$i];
echo $num."<br>";
echo '<img src="'.$num.'" alt="Here should be image" width="256" height="192" >'."<br/>";
}
?>
I used the following code to download the Image (i.e download.php file).
<?php
$file = $_GET['file'];
header("Content-type: image");
header("Content-disposition: attachment; filename= ".$file."");
readfile($file);
?>
How to achieve this?
You mean something like this? :