Code: Alles auswählen
<?php
/***************************************************************
*** Developed by Naums Project in 2010, Stefan Naumann ***
***************************************************************/
$get=$_GET;
if (isset($get["img"]))
{
$img=$get["img"];
}
else
{
$img=NULL;
};
if (isset($get["width"]))
{
$width=$get["width"];
}
else
{
$width=NULL;
};
if (isset($get["height"]))
{
$height=$get["height"];
}
else
{
$height=NULL;
// };
if ($img!=NULL)
{
##resizing an image for diskspace reasons.
/**************************************************************************
*** This Code is taken from the Oettinger Games project and was ***
*** modified slightly for this Homepage ***********************************
*** http://klassenzimmer.scrapping.cc/naums/oettinger-games/pictgal.php ***
*** ******************************************************************* ***
*** Developed by Naums Project 2010 ***************************************
**************************************************************************/
header("content-type:image/jpeg");
$path=explode("-",$img);
$img=NULL; $a=0;
while ($a<count($path))
{
$img.=$path[$a];
$a++;
if ($a!=count($path))
{
$img.="/";
};
};
$src=imagecreatefromjpeg($img);
if ($width==NULL and $height==NULL)
{
list($origwidth, $origheight) = getimagesize($img);
$newWidth=$origwidth;
$newHeight=$origheight;
}
else if ($width!=NULL and $height==NULL)
{
list($origwidth, $origheight) = getimagesize($img);
$newWidth=$width;
$f=$origwidth/$newWidth;
$newHeight=$height/$f;
}
else if ($width==NULL and $height!=NULL)
{
list($origwidth, $origheight) = getimagesize($img);
$newHeight=$height;
$f=$origheight/$newHeight;
$newWidth=$width/$f;
}
else
{
list($origwidth, $origheight) = getimagesize($img);
$newWidth=$width;
$newHeight=$height;
};
$dst=imagecreatetruecolor($newWidth, $newHeight);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $newWidth,$newHeight, $origwidth, $origheight);
imagejpeg($dst, NULL, 100);
imagedestroy($dst);
imagedestroy($src);
/*************************************************************************/
}
else
{
die("<P>ERROR: NO INPUT FILE SPECIFIED</P>");
};
?>
Code: Alles auswählen
http://localhost/schuelerwettbewerb/pict.php?img=pict-games-ablauf.jpg&width=200

Code: Alles auswählen
http://localhost/schuelerwettbewerb/pict.php?img=pict-games-ablauf.jpg&width=200
