rendered paste body<?php
header ("Content-type: image/jpeg");
$grandcote = 200;
$path = @$_GET['path'];
if ($path == null)
{
$photo = imagecreatefromjpeg('images/noimage.jpg');
}
else
{
if (file_exists($path))
{
$filetype = explode('.', $path);
$filetype = $filetype[count(filetype)-1];
if ($filetype == 'jpg')
{
$photo = imagecreatefromjpeg($path);
}
elseif ($filetype == 'png')
{
$photo = imagecreatefrompng($path);
}
else
{
$photo = imagecreatefromjpeg('images/noimage.jpg');
}
}
else
{
$photo = imagecreatefromjpeg('images/noimage.jpg');
}
}
$width = imagesx($photo);
$height = imagesy($photo);
if ($width < $height)
{
$coefficient = $height/$grandcote;
$image_y = $grandcote;
$image_x = $width/$coefficient;
}
elseif ($width > $height)
{
$coefficient = $width/$grandcote;
$image_x = $grandcote;
$image_y = $height/$coefficient;
}
else
{
$image_x = $grandcote;
$image_y = $grandcote;
}
$finx = $image_x + 10;
$finy = $image_y + 10;
$final = imagecreatetruecolor($finx, $finy);
$white = imagecolorallocate($final, 255, 255, 255);
imagefill($final, 0, 0, $white);
$x = imagesx($final);
$y = imagesy($final);
imagecopyresampled($final, $photo, 5, 5, 0, 0, $image_x, $image_y, $width, $height);
imagejpeg($final);
?>