Ignore:
Timestamp:
Dec 3, 2011, 6:11:54 PM (12 years ago)
Author:
patdenice
Message:

Display cache informations on admin page.
Add possibility to clear the cache.
Resize method is now applied on big images.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/GThumb/admin.php

    r12678 r12691  
    99include(dirname(__FILE__).'/config_default.inc.php');
    1010$params = $conf['GThumb'];
     11
     12// Delete cache
     13if (isset($_GET['deletecache']))
     14{
     15  check_pwg_token();
     16  gtdeltree(GTHUMB_CACHE_DIR);
     17  redirect('admin.php?page=plugin-GThumb');
     18}
    1119
    1220// Save configuration
     
    6068);
    6169
     70// Informations
     71$data = gtdirsize(GTHUMB_CACHE_DIR);
     72if ($data['size'] > 1024 * 1024)
     73  $data['size'] = round($data['size'] / (1024 * 1024), 2).' MB';
     74else
     75  $data['size'] = round($data['size'] / 1024, 2).' KB';
     76
     77$template->assign(
     78  array(
     79    'NB_ELEMENTS' => l10n_dec('%d photo', '%d photos', $data['nb_files']),
     80    'ELEMENTS_SIZE' => $data['size'],
     81    'PWG_TOKEN' => get_pwg_token(),
     82  )
     83);
     84
    6285$template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/template/admin.tpl'));
    6386$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
Note: See TracChangeset for help on using the changeset viewer.