View file modules/viewer/psd.php

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

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

$img = new Imagick($url);
$img->mergeImageLayers(Imagick::LAYERMETHOD_MERGE);
$w = $img->getImageWidth() / 1.5;
$h = $img->getImageHeight() / 1.5;
$img->setImageFormat('png');
$img->thumbnailImage($w, $h, null);

echo $img;
exit;

?>