Hallo zusammen,
ich bekomme folgende Fehlermeldung:
Zitat:
|
Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 6400 bytes) in /mnt/am2/08/669/00000006/htdocs/Test/function.php on line 243
|
Dies kommt wenn ich ein Bild mit ca. 500kb hochladen will!
Die function php:
PHP-Code:
function thumb($file, $save, $width, $height, $prop = TRUE) {
// Requires GD-Lib > 2.0
// Ist $prop=TRUE, so werden die Proportionen des Bildes
// auch im Thumbnail eingehalten
@unlink($save);
$infos = @getimagesize($file);
if($prop) {
// Proportionen erhalten
$iWidth = $infos[0];
$iHeight = $infos[1];
$iRatioW = $width / $iWidth;
$iRatioH = $height / $iHeight;
if ($iRatioW < $iRatioH)
{
$iNewW = $iWidth * $iRatioW;
$iNewH = $iHeight * $iRatioW;
} else {
$iNewW = $iWidth * $iRatioH;
$iNewH = $iHeight * $iRatioH;
} // end if
} else {
// Strecken und Stauchen auf Größe
$iNewW = $width;
$iNewH = $height;
}
if($infos[2] == 2) {
// Bild ist vom Typ jpg
$imgA = imagecreatefromjpeg($file);
$imgB = imagecreatetruecolor($iNewW,$iNewH);
imagecopyresampled($imgB, $imgA, 0, 0, 0, 0, $iNewW,
$iNewH, $infos[0], $infos[1]);
imagejpeg($imgB, $save);
} elseif($infos[2] == 3) {
// Bild ist vom Typ png
$imgA = imagecreatefrompng($file);
$imgB = imagecreatetruecolor($iNewW, $iNewH);
imagecopyresampled($imgB, $imgA, 0, 0, 0, 0, $iNewW,
$iNewH, $infos[0], $infos[1]);
imagepng($imgB, $save);
} else {
return FALSE;
}
die Zeile in der Fehlermeldung entspricht der Zeile
PHP-Code:
$imgA = imagecreatefromjpeg($file);
Danke,
Max