Пример #1
0
 public function __construct(Stor $stor, $width = null)
 {
     $this->type = $stor->getType();
     $this->content = $stor->getContent();
     $this->filename = "var/tempthumb" . generateRandomChars(4, "0123456789");
     if (!isset($width)) {
         $this->width = self::DEFAULT_WIDTH;
     } else {
         $this->width = $width;
     }
     $this->make();
 }
Пример #2
0
    echo "<br />";
    echo "Your browser sent a request that could not be understood.";
    exit;
}
if (!isset($_REQUEST['size']) || empty($_REQUEST['size'])) {
    $width = null;
} else {
    $width = $_REQUEST['size'];
}
if (file_exists("var/tokn/" . $_REQUEST['token'])) {
    $token = new ToknFile($_REQUEST['token']);
    if (file_exists("var/stor/" . $token->getReference())) {
        $stor = new Stor(new StorFromFile("var/stor/" . $token->getReference()));
        $thumbnail = new Thumbnail($stor, $width);
        header("Content-Disposition: inline");
        header("Content-Type: " . $stor->getType());
        header("Content-Length: " . $thumbnail->size());
        set_time_limit(0);
        print $thumbnail->raw();
        exit;
    } else {
        header("HTTP/1.1 410 Gone");
        echo "<span style=\"color: red; font-weight: bold; font-size: 24pt;\">410 Gone</span><br />";
        echo "<br />";
        echo "The requested URL is no longer available on this server.";
        exit;
    }
} else {
    header("HTTP/1.1 404 Not Found");
    echo "<span style=\"color: red; font-weight: bold; font-size: 24pt;\">404 Not Found</span><br />";
    echo "<br />";