feature 2541 multisize

- admin GUI for choosing derivative parameters + persistence

git-svn-id: http://piwigo.org/svn/trunk@12820 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
rvelices 2012-01-01 21:10:43 +00:00
parent ec82ebbdcc
commit 95a78ca0d3
9 changed files with 432 additions and 46 deletions

View file

@ -2054,6 +2054,7 @@ function get_active_menu($menu_page)
return 4;
case 'configuration':
case 'derivatives':
case 'extend_for_templates':
case 'menubar':
case 'themes':
@ -2247,23 +2248,34 @@ SELECT
return array_from_query($query, 'user_id');
}
function clear_derivative_cache($type='all')
/** delete all derivative files for one or several types */
function clear_derivative_cache($types='all')
{
$pattern='#.*-';
if ($type == 'all')
if ($types == 'all')
{
$types = ImageStdParams::get_all_types();
$types[] = IMG_CUSTOM;
}
elseif (!is_array($types))
{
$types = array($types);
}
if (count($types)>1)
{
$type_urls = array();
foreach(ImageStdParams::get_all_types() as $dtype)
foreach($types as $dtype)
{
$type_urls[] = derivative_to_url($dtype);
}
$type_urls[] = derivative_to_url(IMG_CUSTOM);
$pattern .= '(' . implode('|',$type_urls) . ')';
}
else
{
$pattern .= derivative_to_url($type);
$pattern .= derivative_to_url($types[0]);
}
$pattern.='(_[a-zA-Z0-9]+)*\.[a-zA-Z0-9]{3,4}$#';
if ($contents = opendir(PHPWG_ROOT_PATH.PWG_DERIVATIVE_DIR))
{
@ -2320,7 +2332,7 @@ function clear_derivative_cache_rec($path, $pattern)
unlink($path.'/index.htm');
}
clearstatcache();
rmdir($path);
@rmdir($path);
}
return $rmdir;
}