Show first available thumbnail instead of a potentially hidden one.

This commit is contained in:
Aaron van Geffen 2020-11-24 11:41:15 +01:00
parent 93884e2e93
commit 340ed84272

View File

@ -138,11 +138,14 @@ class EditAssetForm extends SubTemplate
<h3>Thumbnails</h3>
View: <select id="thumbnail_src">';
foreach ($this->thumbs as $thumb)
$first = INF;
foreach ($this->thumbs as $i => $thumb)
{
if (!$thumb['status'])
continue;
$first = min($i, $first);
echo '
<option data-url="', $thumb['url'], '" data-crop_width="', $thumb['dimensions'][0], '" data-crop_height="', $thumb['dimensions'][1], '"',
isset($thumb['crop_method']) ? ' data-crop_method="' . $thumb['crop_method'] . '"' : '',
@ -171,8 +174,8 @@ class EditAssetForm extends SubTemplate
echo '
</select>
<a id="thumbnail_link" href="', $this->thumbs[0]['url'], '" target="_blank">
<img id="thumbnail" src="', $this->thumbs[0]['url'], '" alt="Thumbnail" style="width: 100%; height: auto;">
<a id="thumbnail_link" href="', $this->thumbs[$first]['url'], '" target="_blank">
<img id="thumbnail" src="', $this->thumbs[$first]['url'], '" alt="Thumbnail" style="width: 100%; height: auto;">
</a>
</div>
<script type="text/javascript">