Restore itok parameter to image URLs in Media elements

Created on 27 August 2021, over 3 years ago
Updated 11 July 2023, over 1 year ago

Problem/Motivation

Recently, we found that our automated Mailchimp emails, which ingest a Views Media RSS feed, stopped generating thumbnails. We found our emails suddenly had broken images for the first time.

We're currently tracking through all the processes that could contribute to this problem, and in the process found that where media:content URLS for images previously were having the itok parameter added to them automatically, now our RSS feed had URLS WITHOUT the itok paramater.

This potentially problematic in our use case, where This Media RSS feed is the only time this particular image style is being used, and therefore is the only call to generate these particular image style thumbnails dynamically.

Doing some research, I found that in D7, the itok parameter was REQUIRED to be passed to Drupal the first time an image style file was generated, and after it was generated, the itok parameter would then be ignored. I assume this is the same practice for D8, but haven't found a good answer as of yet. But I do see that embedded images into content with the Media system are ALSO generating an itok paramater, so its a safe bet D8 needs that paramater for the initial image generation, too.

We also checked on another client site, on which we have not updated this module at all, is still adding the itok paramater in a similar RSS feed. Whereas, on the site with the broken thumbnails in the RSS feed, we had just updated the module for D9 readiness in the last month, right about the time our feed thumbnails started showing up as being broken images.

Steps to reproduce

Update to the latest version of this module's dev branch code.

Create a Views Media RSS feed.

Add an image to your "fields" list, and select an iamge style that is nto being used anywhere else on your site as the style of thumbnail.

In the RSS settings, udner "MEdia", set Media:content to be your image field.

You should find that your (example)
element is missing the itok parameter at the end of the URL.

Proposed resolution

Restore the itok parameter addition via the module code that generates the image URL.

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States nkraft

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024