View file aiv2 AutoIndex/imgload.php

File size: 0.99Kb
<?php
/**
 * @name imgload.php
 * @description Resizes images and makes them downloadable!
 * @package Punk Autoindex  
 * @author MobiHacK
 * @copyright RockiTech Group
 * @version 2.0
 */

require ('config.php');
$neww = intval(@$_GET['x']);
$newh = intval(@$_GET['y']);
if (!isset($neww) or !isset($newh))
exit;
if ($neww > 1600 or $neww < 1)
$neww = 130;
if ($newh > 1600 or $newh < 1)
$newh = 130;

$file = $func->file($_GET['file']);

if (substr($file, 0, 6) == 'files/') {
list($sx, $sy, $type, ) = getimagesize($file);

if ($type == 1) {
$funci = 'imagecreatefromgif';
} //$funco="imagegif";}
elseif ($type == 2) {
$funci = 'imagecreatefromjpeg';
} //$funco="imagejpeg";}
elseif ($type == 3) {
$funci = 'imagecreatefrompng';
} //$funco="imagepng";}
else {
if (isset($funci))
unset($funci);
}
if (isset($type)) {
$im1 = $funci($file);
$im2 = imagecreatetruecolor($neww, $newh);
imagecopyresized($im2, $im1, 0, 0, 0, 0, $neww, $newh, $sx, $sy);

header('Content-type: image/gif');
imagepng($im2);
}
}

?>