Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Commit

Permalink
That later date is right now, apparently
Browse files Browse the repository at this point in the history
  • Loading branch information
aerouk committed Aug 1, 2014
1 parent c37fcfd commit bab47f1
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions public/viewer.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,21 @@
$type = $_GET['type'];
$file = $_GET['file'];

if (RAW_IMAGE) {
$filelocation = __DIR__ . "/images/$type/$file.$type";
$filelocation = __DIR__ . "/images/$type/$file.$type";

if ( ! file_exists($filelocation)) {
header("HTTP/1.0 404 Not Found");
include_once(__DIR__ . '/../app/templates/error.phtml');
die();
}

if ( ! file_exists($filelocation)) {
header("HTTP/1.0 404 Not Found");
include_once(__DIR__ . '/../app/templates/error.phtml');
die();
}
$filesize = filesize($filelocation);

if (RAW_IMAGE) {
$filecontents = fopen($filelocation, 'rb');

header("Content-type: image/$type");
header("Content-length: " . filesize($filelocation));
header("Content-length: " . $filesize);

fpassthru($filecontents);
exit;
Expand All @@ -34,15 +36,5 @@
$time = $time[1] + $time[0];
$start = $time;

$filelocation = __DIR__ . "/images/$type/$file.$type";

if ( ! file_exists($filelocation)) {
header("HTTP/1.0 404 Not Found");
include_once(__DIR__ . '/../app/templates/error.phtml');
die();
}

$filesize = filesize($filelocation);

require_once(__DIR__ . '/../app/templates/viewer.phtml');
}

0 comments on commit bab47f1

Please sign in to comment.