2

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.

Kara
  • 6,115
  • 16
  • 50
  • 57
Cabeludo
  • 21
  • 1
  • 2

4 Answers4

2

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
  • 21
  • 2
0

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 Hopkinson
  • 28,281
  • 7
  • 65
  • 99
0

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
  • 21
  • 1
  • 2
-2

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

Bill the Lizard
  • 398,270
  • 210
  • 566
  • 880
tonnyz
  • 9