forked from Public/pics
ManageAssets: add thumbnails to asset table
This commit is contained in:
@@ -45,6 +45,34 @@ class ManageAssets extends HTMLController
|
||||
},
|
||||
],
|
||||
],
|
||||
'thumbnail' => [
|
||||
'header' => ' ',
|
||||
'is_sortable' => false,
|
||||
'cell_class' => 'text-center',
|
||||
'parse' => [
|
||||
'type' => 'function',
|
||||
'data' => function($row) {
|
||||
$asset = Image::byRow($row);
|
||||
$width = $height = 65;
|
||||
if ($asset->isImage())
|
||||
{
|
||||
if ($asset->isPortrait())
|
||||
$width = null;
|
||||
else
|
||||
$height = null;
|
||||
|
||||
$thumb = $asset->getThumbnailUrl($width, $height);
|
||||
}
|
||||
else
|
||||
$thumb = BASEURL . '/images/nothumb.svg';
|
||||
|
||||
$width = isset($width) ? $width . 'px' : 'auto';
|
||||
$height = isset($height) ? $height . 'px' : 'auto';
|
||||
|
||||
return sprintf('<img src="%s" style="width: %s; height: %s;">', $thumb, $width, $height);
|
||||
},
|
||||
],
|
||||
],
|
||||
'id_asset' => [
|
||||
'value' => 'id_asset',
|
||||
'header' => 'ID',
|
||||
@@ -107,7 +135,7 @@ class ManageAssets extends HTMLController
|
||||
|
||||
$data = Registry::get('db')->queryAssocs('
|
||||
SELECT a.id_asset, a.subdir, a.filename,
|
||||
a.image_width, a.image_height,
|
||||
a.image_width, a.image_height, a.mimetype,
|
||||
u.id_user, u.first_name, u.surname
|
||||
FROM assets AS a
|
||||
LEFT JOIN users AS u ON a.id_user_uploaded = u.id_user
|
||||
|
||||
Reference in New Issue
Block a user