コード例 #1
0
ファイル: reuse.php プロジェクト: s-a-r-id/geograph-project
     //clear the image
     $image = new GridImage();
     header("HTTP/1.0 410 Gone");
     header("Status: 410 Gone");
     $template = "static_404.tpl";
 } else {
     if (isset($_REQUEST['download']) && $_REQUEST['download'] == $image->_getAntiLeechHash()) {
         if (stripos($_SERVER['HTTP_REFERER'], 'seadragon.com') !== FALSE) {
             header("HTTP/1.0 307 Temporary Redirect");
             header("Status: 307 Temporary Redirect");
             header("Location: /photo/" . intval($_REQUEST['id']));
             print "<a href=\"http://{$_SERVER['HTTP_HOST']}/photo/" . intval($_REQUEST['id']) . "\">View image page</a>";
             exit;
         }
         if (in_array(intval($_REQUEST['size']), $CONF['show_sizes'])) {
             $filepath = $image->getImageFromOriginal(intval($_REQUEST['size']), intval($_REQUEST['size']), true);
         } elseif ($_REQUEST['size'] == 'original') {
             $filepath = $image->_getOriginalpath();
         } else {
             $filepath = $image->_getFullpath();
         }
         $filename = basename($filepath);
         $filename = "geograph-" . preg_replace('/_\\w+(\\.jpg)/', " by {$image->realname}\$1", $filename);
         $filename = preg_replace('/ /', '-', trim($filename));
         $filename = preg_replace('/[^\\w-\\.,]+/', '', $filename);
         $lastmod = filemtime($_SERVER['DOCUMENT_ROOT'] . $filepath);
         header("Content-Type: image/jpeg");
         header("Content-Disposition: attachment; filename=\"{$filename}\"");
         customExpiresHeader(86400, true);
         customCacheControl($lastmod, $image->gridimage_id);
         readfile($_SERVER['DOCUMENT_ROOT'] . $filepath);