Thumbnail fallbacks causing error

Hello,

I’m having a problem with adding new thumbnail fallbacks into my module. I wanted to create fallbacks for items where the attached media is hidden based on the resource class, and was able to do that by modifying the thumbnail helper and also adding the new fallbacks to my module’s module.config, ie

'fallbacks' => [
            'fallbacks' => [
                'Still Image' => ['thumbnails/image-fallback.png', 'myModule'],
                'Moving Image' => ['thumbnails/video-fallback.png', 'myModule'],
                'Sound' => ['thumbnails/audio-fallback.png', 'myModule'],
            ],
        ],

Got this all working fine, however when then when I tried to override the original fallbacks that are part of Omeka to match the files I’m using, it causes an error in the ThumbnailManager validateConfig: “Missing thumbnail fallback configuration.”

This seems to be completely independent of what I’m doing with what I’m messing around with the thumbnail helper. Even if I just set the module.config to this, it throws the error:

'fallbacks' => [
            'fallbacks' => [
                'image' => ['thumbnails/image-fallback.png', 'myModule'],
                'video' => ['thumbnails/video-fallback.png', 'myModule'],
                'audio' => ['thumbnails/audio-fallback.png', 'myModule'],
            ],
        ],

Thanks,

Joseph

Ok, I understand now that because the setting for each default, image, video, etc. is an array that when I include that in my module.config it just merges the arrays rather than replace it. I see I can mess with it by using this method here: Advanced Configuration Tricks - tutorials - Laminas Docs

But was that the original intent that these fallbacks couldn’t be overridden? Could that just be changed to something this where it’s a string so that it’s easier to override in a module:

'fallbacks' => [
            'fallbacks' => [
                'image' => [
					'file' => 'thumbnails/image.png',
					'module' => 'Omeka',
				],
				...
        ],

Yeah, the intent there is partially that these entries could be overridden easily, so this is basically just an oversight in how we’re defining those settings.

We’d have to take a little care in changing them though, any change here is likely to not be backwards-compatible.

:+1: thanks—I was able to get what I needed by unsetting the original setting via the method in that tutorial

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