Avoid "Other media" in iiif images

I want to avoid having this

I know it’s possible to set a whitelist in show.phtml, I used it for tiff images, but I don’t know what expression is correct in this case. I tried this but it’s obviously not working

$whitelist = ['image/bmp', 'image/gif', 'image/jpeg', 'image/png', 'image/svg+xml', 'image/tiff', 'image/iiif'];

What you’re saying is that those media in the list are all of the type IIIF Image, right?

Presumably you don’t just want them not listed there, but you want them actually in the top display (a carousel or slider, I’m assuming).

There’s two parts to this: one is that the list you have there uses MIME types and there is no MIME type for a IIIF image: instead you need to look at the ingester or renderer for the media, which will tell you it’s a IIIF media. That’s not a big deal, but the bigger question would be whether the “main” rendering area used by this theme can support a IIIF viewer or not.

Incidentally, what theme is this?

Sorry for the late reply. This is a custom theme based on The Daily.
I’m actually using the Universal Viewer module to display them, so I just need to eliminate the list.
The theme supports IIIF because I need to “eliminate” the native carousel with the BlockDisposition module.

Could you be a little more specific on that? I don’t really understand the part of the ingester/renderer of the media. Sorry.

So, you have code on your show page that looks up against your list there for $media->mediaType() to exclude those image types you have listed. This works for files actually uploaded to the system where we know the media type.

IIIF image media isn’t like that: it has no type since we don’t actually have a copy of the file. Instead you can look at $media->renderer() which is basically the “kind” of media. You may see code in there already that specially handles the case where the renderer is 'youtube'. Similarly you can check if $media->renderer() is 'iiif' to exclude IIIF Image media.

1 Like

That’s right, it worked!
But now I have all the <ul id="itemfiles" class="media-list"> that I needed to eliminate. To do that I wrote:

<?php $this->trigger('view.show.before'); ?>
<?php if (strpos($mediaRenderer, 'iiif') !== false  ): { }?> //added this
<?php elseif ($item->media()): ?>
<ul id="itemfiles" class="media-list">
    <?php foreach ($lightMedia as $media): ?>
        <?php $source = ($media->originalUrl()) ? $media->originalUrl() : $media->source(); ?>
        <li data-src="<?php echo $source; ?>" data-thumb="<?php echo $escape($media->thumbnailUrl('medium')); ?>" class="media resource">
            <?php echo $media->render(); ?>
    <?php endforeach; ?>
<?php endif; ?>

Just to be sure that’s the right solution (it seems to be working for me).

This topic was automatically closed 250 days after the last reply. New replies are no longer allowed.