You are here

function filebrowser_update_thumbnails in Filebrowser 6.2

Same name and namespace in other branches
  1. 8 filebrowser.pages.inc \filebrowser_update_thumbnails()
  2. 7.4 filebrowser.pages.inc \filebrowser_update_thumbnails()
  3. 7.2 filebrowser.pages.inc \filebrowser_update_thumbnails()
  4. 7.3 filebrowser.pages.inc \filebrowser_update_thumbnails()
1 string reference to 'filebrowser_update_thumbnails'
filebrowser_menu in ./filebrowser.module
Implementation of hook_menu().

File

./filebrowser.pages.inc, line 77

Code

function filebrowser_update_thumbnails($fid) {
  $content = _filebrowser_node_content_load($fid);
  $node = node_load($content['nid']);
  _filebrowser_load_files($node, $fid);
  $form['#node'] = $node;
  $batch = array(
    'operations' => array(),
    'title' => t('Processing Thumbnail Updating'),
    'init_message' => t('Thumbnail updating is starting.'),
    'progress_message' => t('Processed @current out of @total thumbnauls.'),
    'error_message' => t('Thumbnail updating has encountered an error.'),
  );
  $thumbnailers = module_implements("filebrowser_thumbnailer_prepare");
  foreach ($node->file_listing as $name => &$file) {
    foreach ($thumbnailers as $thumbnailer) {
      if ($node->file_handlers->{$thumbnailer}->enabled_thumbnailer) {
        $operations = module_invoke($thumbnailer, "filebrowser_thumbnailer_prepare", $file, $node->file_handlers->{$thumbnailer});
        if ($operations && count($operations)) {
          $batch['operations'] = array_merge($batch['operations'], $operations);
        }
      }
    }
  }

  //  echo "<pre>"; var_dump($batch); exit();
  if (count($batch['operations'])) {
    batch_set($batch);
    batch_process($_GET['destination']);
  }
  else {
    drupal_set_message("No operation needed for thumbnail updating");
    drupal_goto();
  }
}