pict.php
Verfasst: Mo Aug 30, 2010 7:44 pm
Ich bin ja hier schon fast Stammgast... Also mein heutiges Problem: Ich übergebe folgender Datei (pict.php) folgende Parameter. Quelltext:
url:
Die Datei existiert. Der Filename ist so buzzsch eingetragen, weil ich gedacht habe das / darf man in Adressen nicht benutzen, zumindest nicht wenns kein Unterordner sein soll
Warum gibt mir header("content-type:image/jpeg"); folgendes aus: und nicht das bild? selbst wenn ich alles dahinterstehende auskommentiere kommt immernoch dieser Schriftzug. Vielen dank schonmal im Vorraus. (schreibt man das Voraus oder Vorraus? Kann mich nie entscheiden
)
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
