Add thumbnails to snapshots list

This commit is contained in:
Isaac Connor 2021-03-12 10:07:17 -05:00
parent 527defc0c8
commit 70073ea017
3 changed files with 10 additions and 8 deletions

View File

@ -190,13 +190,14 @@ function queryRequest($search, $advsearch, $sort, $offset, $order, $limit) {
foreach ( array_slice($filtered_rows, $offset, $limit) as $row ) {
$snapshot = new ZM\Snapshot($row);
//$scale = intval(5*100*ZM_WEB_LIST_THUMB_WIDTH / $event->Width());
//$imgSrc = $event->getThumbnailSrc(array(), '&');
//$streamSrc = $event->getStreamSrc(array(
//'mode'=>'jpeg', 'scale'=>$scale, 'maxfps'=>ZM_WEB_VIDEO_MAXFPS, 'replay'=>'single', 'rate'=>'400'), '&');
$row['imgHtml'] = '';
// Modify the row data as needed
//$row['imgHtml'] = '<img id="thumbnail' .$event->Id(). '" src="' .$imgSrc. '" alt="Event '.$event->Id().'" width="' .validInt($event->ThumbnailWidth()). '" height="' .validInt($event->ThumbnailHeight()).'" stream_src="' .$streamSrc. '" still_src="' .$imgSrc. '"/>';
foreach ( $snapshot->Events() as $event ) {
$scale = intval(5*100*ZM_WEB_LIST_THUMB_WIDTH / $event->Width());
$imgSrc = $event->getThumbnailSrc(array(), '&amp;');
$row['imgHtml'] .= '<img id="thumbnail' .$event->Id(). '" src="' .$imgSrc. '" alt="Event '.$event->Id().'" width="' .validInt($event->ThumbnailWidth()). '" height="' .validInt($event->ThumbnailHeight()).'"/>';
}
$row['Name'] = validHtmlStr($row['Name']);
$row['Description'] = validHtmlStr($row['Description']);
//$row['Archived'] = $row['Archived'] ? translate('Yes') : translate('No');
@ -209,6 +210,7 @@ function queryRequest($search, $advsearch, $sort, $offset, $order, $limit) {
//$row['Storage'] = ( $row['StorageId'] and isset($StorageById[$row['StorageId']]) ) ? $StorageById[$row['StorageId']]->Name() : 'Default';
//$row['Notes'] = nl2br(htmlspecialchars($row['Notes']));
//$row['DiskSpace'] = human_filesize($event->DiskSpace());
//
$returned_rows[] = $row;
} # end foreach row matching search

View File

@ -54,7 +54,7 @@ function processRows(rows) {
row.Name = '<a href="?view=snapshot&amp;id=' + id + '">' + row.Name + '</a>';
row.Description = '<a href="?view=snapshot&amp;id=' + id + '">' + row.Description + '</a>';
//if ( WEB_LIST_THUMBS ) row.Thumbnail = '<a href="?view=snapshot&amp;id=' + row.Id '">' + row.imgHtml + '</a>';
if (WEB_LIST_THUMBS) row.Thumbnail = '<a href="?view=snapshot&amp;id=' + id +'">' + row.imgHtml + '</a>';
});
return rows;

View File

@ -77,7 +77,7 @@ getBodyTopHTML();
<th data-sortable="true" data-field="Id"><?php echo translate('Id') ?></th>
<th data-sortable="true" data-field="Name"><?php echo translate('Reference') ?></th>
<th data-sortable="false" data-field="Description"><?php echo translate('Notes') ?></th>
<th data-sortable="true" data-field="CreatedOn"><?php echo translate('AttrWhen') ?></th>
<th data-sortable="true" data-field="CreatedOn"><?php echo translate('When') ?></th>
<th data-sortable="false" data-field="Thumbnail"><?php echo translate('Thumbnail') ?></th>
</tr>
</thead>