Skip to content

Commit

Permalink
! tiff files will not lightbox in all browsers, so show the descripti…
Browse files Browse the repository at this point in the history
…on with link

which will likely ask to download but that is better than a stuck ajax spinner
  • Loading branch information
Spuds committed Jan 1, 2024
1 parent 5169b99 commit a785520
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions levgal_tpl/LevGal-Item.template.php
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ function template_item_picture()

// Maybe we're showing a preview of the thing, or maybe we're just inlining the thing.
$using = empty($context['item_display']['urls']['preview']) ? 'raw' : 'preview';
if (!empty($context['item_display']['needs_lightbox']))
if (!empty($context['item_display']['needs_lightbox']) && $context['item_details']['mime_type'] !== 'image/tiff')
{
echo '
<div id="item_picture_container" class="lg_item">
Expand All @@ -712,6 +712,19 @@ function template_item_picture()
</div>
</div>';
}
elseif ($context['item_display']['needs_lightbox'] && $context['item_details']['mime_type'] === 'image/tiff')
{
// Browser tiff support is very spotty so for now we dont want it in glightbox
echo '
<div id="item_picture_container" class="lg_item">
<a href="', $context['item_display']['urls']['raw'], '">
<img id="item_picture" class="item_', $using, '" src="', $context['item_display']['urls'][$using], '" alt="" />
</a>
<div class="custom-desc hide">',
$context['item_details']['description'], '
</div>
</div>';
}
else
{
// If it's not big enough to need a preview, display the actual GIF in case it has animation.
Expand Down Expand Up @@ -1112,6 +1125,7 @@ function template_edit_item()
lgal_quota: ' . (empty($context['quota_data']) ? '{}' : json_encode($context['quota_data'])) . ',
lgal_enable_resize: ' . (empty($context['lgal_enable_resize']) ? 'false' : 'true') . ',
maxFiles: 1,
maxThumbnailFilesize: defaults.maxThumbnailFilesize,
paramName: defaults.paramName,
chunking: defaults.chunking,
retryChunks: defaults.retryChunks,
Expand Down Expand Up @@ -1163,7 +1177,7 @@ function template_edit_item()
});
},
accept: function(file, done) {
this.on("thumbnail", function(file) {
this.on("thumbnail", function(file, dataURL) {
let result = addFileFilter(file, this.options.lgal_quota, this.options.lgal_enable_resize);
if (result !== true)
{
Expand All @@ -1173,6 +1187,13 @@ function template_edit_item()
}
else
{
// This is for tiff files, maybe others, which fail on creating a client side thumbnail
if (typeof dataURL === "object" && dataURL instanceof Event)
{
let dataURL = get_upload_generic_thumbnail(file, this.options.lgal_quota);
file.previewElement.querySelector("img[data-dz-thumbnail]").src = dataURL;
}
done();
}
});
Expand Down

0 comments on commit a785520

Please sign in to comment.