so on my local server my uploading pictures page works perfectly. now on my remote server i get the memory "exhausted error"
"Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 1332 bytes) in /home/virtual/site131/fst/var/www/html/cms/picture_action.php on line 42"
as you can see, the files aren't even that big, so i have no clue what's causing this.
i've searched the forum, but i'm not able to configure my php.ini file, so that's not an option..
any other ideas ?
the line which causes the error is:
$newpicture = imagecreatetruecolor($maxwidth, $maxheight);
<?php
require_once('../scripts/connection.php');
$action = $_POST['action'];
$id = $_POST['id'];
$input_date = $_POST['input_date'];
$name = $_POST['name'];
$place = $_POST['place'];
$photographer = $_POST['photographer'];
$date = $_POST['date'];
$maxsize = 6000000;
if($action == "new") {
foreach ($_FILES["picture"]["error"] as $key => $error) {
if ($error == UPLOAD_ERR_OK) {
$uploaddir = './../images/upload/';
$uploaddir_thumb = './../images/upload/thumbs/';
$imagename = $_FILES['picture']['name'][$key];
$temp_picture = $_FILES['picture']['tmp_name'][$key];
$imagesize = getimagesize($temp_picture);
$uploaded_picture = $uploaddir . $imagename ; //full path
$uploaded_thumb = $uploaddir_thumb . $imagename;
$image_type = $imagesize[2];
$width = $imagesize[0]; //oude breedte -- height is de eerste waarde van de array die getimagesize als uitkomst geeft
$height = $imagesize[1]; //oude hoogte
$thumbwidth = 50; //breedte van de thumbnail
$thumbheight = 50; // hoogte van de thumbnail
if($width > $height){
$maxwidth = 500; //nieuwe breedte
$maxheight = ((500 / $imagesize[0]) * $imagesize[1]); //nieuwe hoogte
}
elseif ($width < $height) {
$maxwidth = ((500 / $imagesize[1]) * $imagesize[0]);
$maxheight = 500;
}
$oldpicture = imagecreatefromjpeg($temp_picture);//van de upgeloade temp. cover een jpg maken.
$newpicture = imagecreatetruecolor($maxwidth, $maxheight);//een zwarte afbeelding creëren met die nieuwe afmetingen
imagecopyresampled($newpicture, $oldpicture, 0,0,0,0, $maxwidth, $maxheight, $width, $height);//resizen van oude cover naar nieuwe met
//de ingestelde parameters
imagejpeg($newpicture, $temp_picture, 100); //die geresizede afbeelding bruikbaar maken
if (move_uploaded_file($temp_picture, $uploaded_picture)) {
$oldthumb = imagecreatefromjpeg($uploaded_picture);
$thumb = imagecreatetruecolor($thumbwidth, $thumbheight);
imagecopy($thumb, $oldthumb, 0,0,200,180, 50,50);
imagejpeg($thumb,$uploaded_thumb,100);
imagedestroy($thumb);
imagedestroy($oldthumb);
$picture = $uploaded_picture;
$insertQuery = "INSERT INTO mash_images_bands (id,input_date, name, place, date, path, thumbnail, photographer) VALUES ('$id',
'$input_date','$name','$place','$date','$picture', '$uploaded_thumb','$photographer')";
}
$results = mysql_query( $insertQuery );
if($results){
echo "<img src='".$picture."' class='pic_preview'>";
echo "<img src='".$uploaded_thumb."'>";
}
else{
die( "Trouble Saved: " . mysql_error() );
}
}
}
if($results){
echo "<br><br>";
echo "your pictures were succesfully uploaded.";
echo "<br><br>";
echo "<b>name:</b> ".$name;
echo "<br>";
echo "<b>place:</b> ".$place;
echo "<br>";
echo "<b>date:</b> ".$date;
echo "<br>";
echo "<b>photographer:</b> ".$photographer;
echo "<br><br>";
echo ("<a href='cms_index.php?p=3&action=new' target='_self'>want to upload more pictures ?</a>");
}
}
?>
thanx guys & girls. i hope i can return the favor someday when my knowledge has expanded..