Page 1 of 1

memory size exausted + strange behavior

Posted: Wed May 18, 2005 7:59 pm
by Skara
aaaaaahahahaha... erhm.

I'm tring to upload an 8mb file (the very smallest of the files I'll have) and I'm getting...
Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 2048 bytes) in /var/www/photos/admin/thumbnail.php on line 8

Code: Select all

if(!($src_img = imagecreatefromjpeg($image))) return &quote;Error in imagecreatefromjpeg({$image})&quote;;
Here's the weird part... There's nothing there--no directory, no files. Let me explain. Before that line, there's this code:

Code: Select all

if (!mkdir($uppath.$dir)) err(&quote;Unable to create directory '{$dir}'. Alread uploaded?&quote;);
else {
  //...
  if (!move_uploaded_file($_FILESї'userfile']ї'tmp_name'], $upfile)) err('Unable to move uploaded file.');
  //...
  exec(&quote;tar xfz {$basefile} 2>/var/www/photos/uhoh&quote;);
  //...
  require '../../admin/thumbnail.php';
  if (($handle = opendir('.')) !== false) {
    for ($n=0; false !== ($file = readdir($handle)); $n++) {
      if (preg_match('/.+?\.jpg$/',$file)) {
        chmod($file,0644);
        $res = thumb($dir,$file);
        if ($res !== true) err('Unable to create thumbnail: '.$res);
      }
    }
  }
  //...
Line 8 in thumbnail.php doesn't even get called unless the script enters the correct directory (when thumb() is called). But then nothing is there after the script "finishes." $dir and it's contents dissappear. O.o THAT is weird.

So anyway, how can I fix this bugger?

Edit: O.O Ok.. I know you won't believe this.. It appeared again. As in it's there now. I promise it wasn't there before!!! I ran a script that read all the dirs (that matched a type) and afterwards it was there!! o.o

Ok. Whatever.

SO:
Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 2048 bytes) in /var/www/photos/admin/thumbnail.php on line 8
Edit: oh bugger. I just realized I tar'd the wrong damn files. XD No wonder!! It was trying to use an image that was... *looks* ..well, 669kb, but 2048x1536px. Hahaha. I marvel at my own stupidity sometimes.

Posted: Thu May 19, 2005 3:46 am
by phpScott
been there, done that. :oops: :cry: :x