views:

697

answers:

5

I'm using phpThumb - the PHP thumbnail generator.

'phpThumb.config.php':

$PHPTHUMB_CONFIG['cache_maxage'] = 10; 

$PHPTHUMB_CONFIG['cache_maxsize'] = 1000; 

$PHPTHUMB_CONFIG['cache_maxfiles'] = 10;

but it does nothing... I've got 108 MB in 922 files... and it keeps growing.

Thanks for any suggestions.

A: 

I'd check that the user that php is running as has write permissions on the cache folder.

Have you checked the php error log?

adam
A: 

funny, in phpThumb.config.php default line was uncommented:

$PHPTHUMB_CONFIG['document_root'] = realpath((getenv('DOCUMENT_ROOT') && ereg('^'.preg_quote(realpath(getenv('DOCUMENT_ROOT'))), realpath(__FILE__))) ? getenv('DOCUMENT_ROOT') : str_replace(dirname(@$_SERVER['PHP_SELF']), '', str_replace(DIRECTORY_SEPARATOR, '/', dirname(__FILE__))));

..and phpThumb succeed in saving files into 'cache' dir, but was unable to delete any files.

I setted $PHPTHUMB_CONFIG['document_root'] mannualy and it works!

So, doublecheck if $PHPTHUMB_CONFIG['document_root'] is correct.

Cabeludo
A: 

Hello, I've got the same problem but I'm using the phpThumb() object, so I don't use the phpThumb.config.php file. I've try to set up the paramters like that :

phpThumb->setParameter('cache_maxfiles', 1);

But I've no result. The cache files still writing in folder of the file which call the phpthumb() function (I'have a folder "engine" which contain a folder "phpThumb", the file which call phpThumb() is inside "engine", and the cache files are inside "engine" too.

So I don't know how to set up the parameters to destroy the cache file after the image files is saved or to have just 1 cache file.

Thank you.

HDready-graphic
A: 

For me the solution was really simple. After installing phpthumb with the default settings the line $PHPTHUMB_CONFIG['document_root'] = realpath((getenv('DOCUMENT_ROOT') && ereg('^'.preg_quote(realpath(getenv('DOCUMENT_ROOT'))), realpath(__FILE__))) ? getenv('DOCUMENT_ROOT') : str_replace(dirname(@$_SERVER['PHP_SELF']), '', str_replace(DIRECTORY_SEPARATOR, '/', dirname(__FILE__)))); wasn't uncommeted and all seems to work fine.

BUT: the /tmp directory runs out of space in very short time on a high frequented page.

SOLUTION: It was simple, since phpthumb needs WRITE PERMISSIONS on its $PHPTHUMB_CONFIG['cache_directory'] directory. So be sure that the user who executes your php scripts (usually apache) has the permission to write, otherwise the /tmp directory will be used and filled up with your cached files.

hope this helps!

siconet
A: 

it's simple, you just delete the cache folder. phpThumb will re-create your thumb later.

nhan dang thuong hieu

tonnyz