function filebrowser_update_thumbnails in Filebrowser 8
Same name and namespace in other branches
- 6.2 filebrowser.pages.inc \filebrowser_update_thumbnails()
- 7.4 filebrowser.pages.inc \filebrowser_update_thumbnails()
- 7.2 filebrowser.pages.inc \filebrowser_update_thumbnails()
- 7.3 filebrowser.pages.inc \filebrowser_update_thumbnails()
1 call to filebrowser_update_thumbnails()
File
- ./
filebrowser.pages.inc, line 151 - Several support functions for filebrowser
Code
function filebrowser_update_thumbnails($fids) {
if (!is_array($fids)) {
$fids = array(
$fids,
);
}
$batch = array(
'operations' => array(),
'title' => t('Processing Thumbnail Updating'),
'init_message' => t('Thumbnail updating is starting.'),
'progress_message' => t('Processed @current out of @total thumbnails.'),
'error_message' => t('Thumbnail updating has encountered an error.'),
);
$thumbnailers = module_implements("filebrowser_thumbnailer_prepare");
foreach ($fids as $fid) {
$content = _filebrowser_node_content_load($fid);
$node = node_load($content['nid']);
_filebrowser_load_files($node, $fid);
foreach ($node->file_listing as $name => &$file) {
module_invoke($thumbnailer, "filebrowser_thumbnailer_cleanup", $node);
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(t("No operation needed for thumbnail updating"));
}
}