<?php
// if(!ctype_digit($_GET['w'])) die('Hacking Attempt...');
// if(!ctype_digit($_GET['id'])) die('Hacking Attempt...');
# id [[user]]
# title [[filename]]
# filename [[path]]
# w
# ext
define('THUMBNAIL_SIZE', $_GET['w']);
if (!isset($_GET['fileName']) || $pathInfo = pathinfo($_GET['fileName']); if ($pathInfo['extension'] == 'jpg')
$pathInfo['extension'] = 'jpeg';
if (!function_exists(($fName =
'imagecreatefrom'.$pathInfo['extension'])))
$imgHandle = $fName($_GET['fileName']);
$ratio = ($imgW = imagesx($imgHandle)) /
($imgH = imagesy($imgHandle));
if ($ratio > 1) {
$newImgW = THUMBNAIL_SIZE;
$newImgH = THUMBNAIL_SIZE / $ratio;
} else {
$newImgW = THUMBNAIL_SIZE * $ratio;
$newImgH = THUMBNAIL_SIZE;
}
$newImageHandle = imagecreatetruecolor($newImgW,
$newImgH);
imagecopyresampled($newImageHandle, $imgHandle,
0, 0, 0, 0, $newImgW, $newImgH, $imgW, $imgH);
header('Content-type: image/'.$pathInfo['extension']); $fName = 'image'.$pathInfo['extension'];
$fName($newImageHandle);
imagejpeg($newImageHandle, 'v/'.$_GET['id'].'/'.$_GET['title'].'.'.$_GET['w'].'.'.$_GET['ext'] , 100);
?>
albo znalexc podobny skrypt co nie wywala komunikatu bledu ?