Ignore:
Timestamp:
04/17/11 21:08:06 (9 years ago)
Author:
patdenice
Message:

feature:2259
Add "Regenerate Websize Photos" action.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/batch_manager_global.php

    r10389 r10454  
    4444} 
    4545 
     46// User cache must not be regenerated during simultaneous ajax requests 
     47if (!isset($user['need_update']) or !$user['need_update']) 
     48{ 
     49  getuserdata($user['id'], true); 
     50} 
     51 
    4652// +-----------------------------------------------------------------------+ 
    4753// | Check Access and exit when user status is not ok                      | 
     
    410416 
    411417    if ($_POST['regenerateError'] != '0') 
    412       array_push($page['warnings'], sprintf(l10n('%s thumbnails have been regenerated'), $_POST['regenerateError'])); 
    413  
     418      array_push($page['warnings'], sprintf(l10n('%s thumbnails can not be regenerated'), $_POST['regenerateError'])); 
     419 
     420    $update_fields = array('thumb_maxwidth', 'thumb_maxheight', 'thumb_quality'); 
     421  } 
     422 
     423  if ('regenerateWebsize' == $action) 
     424  { 
     425    if ($_POST['regenerateSuccess'] != '0') 
     426      array_push($page['infos'], sprintf(l10n('%s photos have been regenerated'), $_POST['regenerateSuccess'])); 
     427 
     428    if ($_POST['regenerateError'] != '0') 
     429      array_push($page['warnings'], sprintf(l10n('%s photos can not be regenerated'), $_POST['regenerateError'])); 
     430 
     431    $update_fields = array('websize_maxwidth', 'websize_maxheight', 'websize_quality'); 
     432  } 
     433 
     434  if (!empty($update_fields)) 
     435  { 
    414436    // Update configuration 
    415     $fields = array('thumb_maxwidth', 'thumb_maxheight', 'thumb_quality'); 
    416437    $updates = array(); 
    417     foreach ($fields as $field) 
     438    foreach ($update_fields as $field) 
    418439    { 
    419440      $value = null; 
     
    451472        ); 
    452473    } 
    453     function regenerateThumbnails_prefilter($content, $smarty) 
    454     { 
    455       return str_replace('{$thumbnail.TN_SRC}', '{$thumbnail.TN_SRC}?rand='.md5(uniqid(rand(), true)), $content); 
    456     } 
    457     $template->set_prefilter('batch_manager_global', 'regenerateThumbnails_prefilter'); 
    458474    $template->delete_compiled_templates(); 
    459475  } 
     
    784800  ); 
    785801 
     802function regenerateThumbnails_prefilter($content, $smarty) 
     803{ 
     804  return str_replace('{$thumbnail.TN_SRC}', '{$thumbnail.TN_SRC}?rand='.md5(uniqid(rand(), true)), $content); 
     805} 
     806$template->set_prefilter('batch_manager_global', 'regenerateThumbnails_prefilter'); 
     807 
    786808trigger_action('loc_end_element_set_global'); 
    787809 
Note: See TracChangeset for help on using the changeset viewer.