View file modules/viewer/gif.php

File size: 560B
<?php
require_once $_SERVER['DOCUMENT_ROOT'].'/system/function.php';
header('Content-type:image/jpeg');

$name = isset($_GET['image']) ? guard($_GET['image']) : null;
$url = H.'/files/'.$name;
$gif = imagecreatefromgif($url);
if (empty($name)) {
	header('HTTP/2.0 404 Not found');
	exit;
} elseif (!file_exists($url)) {
	header('HTTP/2.0 404 Not found');
	exit;
}

$w = imagesx($gif);
$h = imagesy($gif);
$img = imagecreate($w, $h);
imagecopyresampled($img, $gif, 0, 0, 0, 0, $w, $h, $w, $h);

imagejpeg($img);
imagedestroy($gif);
imagedestroy($img);
exit;

?>