Commit 85671223 authored by Steve's avatar Steve
Browse files

#2099 Putting in thumbnails for the files list.

parent 2e28b335
......@@ -22,3 +22,29 @@ function workbench_files_views_api() {
function workbench_files_views_default_views() {
return workbench_load_all_exports('workbench_files', 'views', 'view.inc', 'view');
}
/**
* Implementation of hook_preprocess_views_view_table().
*
* This is done to convert the "type" field to a thumbnail for image files.
*/
function workbench_preprocess_views_view_table(&$vars) {
// Custom handling for the workbench files view
if ($vars['view']->name == 'workbench_files') {
foreach($vars['rows'] as $id => $row) {
// Is this file an image?
if (strstr(file_get_mimetype($row['uri']), 'image')) {
// Is this file on the local file system?
if (file_exists($row['uri_1'])) {
$row['filemime'] = theme('image_style', array(
'path' => $row['uri_1'],
'style_name' => 'thumbnail',
));
}
}
// Assign the databack
$vars['rows'][$id] = $row;
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment