<?php

if (!isset($_GET['pic'])) {
	exit('Не передан адрес картинки');
}
$picPath = str_replace('http://'. $_SERVER["HTTP_HOST"], $_SERVER["DOCUMENT_ROOT"], $_GET['pic']);
if (!file_exists($picPath)) {
	exit("Не найдена картинка $picPath");
}

header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename=' . basename($picPath));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($picPath));
readfile($picPath);
    



?>