Resizing images - images too big?

See all posts See thread Reply

Re: Resizing images - images too big? new!
by Bruno Chavez, 16 years ago
Hi!!

I have the same problem, I work with local files, I uploaded with a perl cgi that I wrote, because my server is so limited in time limit, then when I process a small image, works really fine, but when I process 1MB > crash... don't tell anything, any error, simply when execute $handle->Process('../img/Thumbs1/'); don't continue... break...

Can you help me... my code is:

$handle = new Upload('../img/cuadros/' . $Archivo);
$handle->file_max_size='10240000';
if ($handle->uploaded) {
  $handle->image_convert         = 'jpg';
  $handle->image_resize            = true;
  $handle->image_ratio_y           = true;
  $handle->image_ratio_x           = true;
  $handle->image_x                 = 580;
  $handle->image_y                 = 460;
  $handle->Process('../img/Thumbs1/');
  if ($handle->processed) {
    rename('../img/Thumbs1/' . $handle->file_dst_name, '../img/Thumbs1/' . $ArchivoFin); 
  }
  $handle-> Clean();
}

please I need it...

Regards
Bruno ChávezReply
Re: Resizing images - images too big? new!
by colin, 16 years ago
Check the posts above. You are running out of memory. See this thread

Try to raise your local memory to 20M, 32M or more.

You can add this in your script:
ini_set ( "memory_limit", "20M")

Or in a .htaccess file:
php_value memory_limit 20M
Reply
Re: Resizing images - images too big? new!
by Ravan, 13 years, 7 months ago
My image is 3264x2448 and my php memory limit is 64M and it still doesn't work. why?Reply
Re: Resizing images - images too big?
by colin, 13 years, 7 months ago
3264x2448 = 7 990 272 ~= 8Mpixels
8M * 8 bits = 64Mbytes

So with this picture, just to load it in memory, you a reaching your memory limit. Your application probably use some memory too, and if you do processing on the image, you need more memory.Reply