Loading an image using a PHP script

105

<?php
$file = "https://example.com/March.jpg";
$contents =  file_get_contents($file);
$expires = 14 * 60*60*24;
header("Content-Type: image/jpg");
header('Content-disposition: attachment; filename="March.jpg"'); //Use for force to download
header("Content-Length: " . strlen($contents));
header("Cache-Control: public", true);
header("Pragma: public", true);
header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT', true);
echo $contents; //Image load
?>

Comments

Submit
0 Comments