View Single Post
Old 10-22-2009, 05:58 AM   #1 (permalink)
Aaron
The Frequenter
 
Join Date: Dec 2007
Location: In my basement
Posts: 386
Thanks: 47
Aaron is on a distinguished road
Default GD Exceeding Memory Size... What?

Fatal error:Allowed memory size of 16777216 bytes exhausted (tried to allocate 2816 bytes) in W:\htdocs\xxx\index.php on line 62


PHP Code:
function createThumbs($rawImage$imgDir){
  
chdir($imgDir);
  
$thumbDir '/thumbs/';
  if (!
file_exists($thumbDir)){
    
mkdir($thumbDir);
  }
  
$filename $rawImage;
  
$thumbHeight 300;
  
header('(anti-spam-(anti-spam-content-type:)) image/jpeg');
  
  
// Get new sizes
  
list($width$height) = getimagesize($filename);
  
$ratio = ($height/$width);
  
$newHeight $thumbHeight;
  
$newWidth = ($thumbHeight/$ratio);
  
  
// Load
  
$thumb imagecreatetruecolor($newWidth$newHeight);
  
$source imagecreatefromjpeg($filename);  // Line 62
  
  // Resize
  
imagecopyresized($thumb$source0000$newWidth$newHeight$width$height);
  
  
// Output
  
imagejpg($thumb$thumbDir100);

So... How do I resolve this problem?
__________________
Signatures are nothing but incriminating.
Send a message via MSN to Aaron
Aaron is offline  
Reply With Quote