$picture = $_REQUEST[picture];
$type = $_REQUEST[type];
$OUT = $_REQUEST[OUT];
if ( isset($picture) )
{
if ( !preg_match("#php|jpg|jpeg|png|gif$#i", $picture) )
{
die("
Invalid file type
");
}
}
$rand=rand(1, 1000);
$JPG="temp/PIC_$rand.jpg";
$GIF="temp/PIC_$rand.gif";
$PNG="temp/PIC_$rand.png";
if ( $type == 1 )
{
$im = imagecreatefromgif($picture);
imagegif($im,('temp/image.gif'));
exec ("/usr/bin/convert temp/image.gif $OUT");
}
if ( $type == 2 )
{
$im = imagecreatefromjpeg($picture);
imagejpeg($im,('temp/image.jpg'));
exec ("/usr/bin/convert temp/image.jpg $OUT");
}
if ( $type == 3 )
{
$im = imagecreatefrompng($picture);
imagepng($im,('$temp/image.png'));
exec ("/usr/bin/convert temp/image.png $OUT");
}
echo "

";
echo $OUT;
echo "
";
?>