Jump to content

GD Library memory issue.


Dan Holm

Recommended Posts

Hi!

 

I have a problem when making thumbnails from larger images using the functions in GD Library. For small images this works fine but for larger, not at all. From what I understand from other threads this is due to a memory shortage in GD. Is there any way I could somehow scale down the image size or change image quality before using the GD?

Any help is deeply appreciated.

Link to comment
https://forums.phpfreaks.com/topic/183639-gd-library-memory-issue/
Share on other sites

Hi Dan,

First of all I remember when I had these problems and its a bit of a rocky boat,

First off I am going to assume your on a shared host,

first thing you can try

at the start of the script add

set_time_limit (0); // turn off timeout
ini_set("memory_limit", "128M"); //set memory allocation to 128Mb

 

Now on a shared host they may block this or send you a email telling you your not allowed to do it (or words to that effect)

 

another option maybe to run it thought Image magick (it the server supports it)

ie

<?php
$image = new Imagick($filename);
$image->thumbnailImage($size, $vsize);
header("Content-type: image/png");
print $image;
?>

 

only other option i can think of is upgrade the server/package

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.