(For reasons to tiresome to explain - current guess is it was something to do with migration...)
It can be helpful or necessary to manually trigger a regeneration or reset of a media items designated thumbnail.
The code already provides an API call to do that pretty easily, but there seems to be no UI for it.
Drupal\media_entity\Entity\Media::automaticallySetThumbnail()
*Ideally* all parts of the system would always know how to keep the thumbnail up to date at all times, but issues ike
#2749695: Thumbnail not updated
#2786881: Recalculate thumbnail size during update
show this is not always straightforward.
Though it could be argued it's not *necessary* - it is *useful* . Ideally, the image_style management would always be up to date as well, yet the core image style management UI provides the 'flush' action on image styles as a utility anyway, and sometimes it's handy - especially during site migrations etc.
Exposing the 'Action' as an admin assistant seems easy and harmless. I did a local trial and it works as needed for me. I'll see if I can get a PR into github..
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | interdiff.txt | 599 bytes | marcoscano |
| #7 | 2869239-7.patch | 2.22 KB | marcoscano |
| #4 | 2869239-4.patch | 2.24 KB | dman |
| #2 | media_entity-refresh_thumbnail.gif | 302.88 KB | dman |
Comments
Comment #2
dman commentedPull request over at https://github.com/drupal-media/media_entity/pull/84 now.
Apologies if the protocol isn't quite right, I'm not up to speed on github ettiquette.
Comment #3
marcoscanoAlthough normally at this point no new features should be getting added to the 1.x branch, the work here is done and could potentially help reduce some of the issues some users have with the thumbnail updating process.
Marking as Needs Review to have a second opinion on this.
@dman thanks for the contribution! Could you please also upload a patch here? This helps commenting on the issue for reviewers.
Thanks!
Comment #4
dman commentedHeh...
Github makes generating a patch easy, it would seem!
https://patch-diff.githubusercontent.com/raw/drupal-media/media_entity/p...
Let's see if the Drupal patch management system co-operates with that...
Comment #6
dman commentedThose fails have nothing to do with me :-p
Comment #7
marcoscanoIn tests the schema definition for config entities is enforced.
Let's see if the testbot likes it this time.
Comment #8
dman commentedIndeed ... I'm actually deep in the throes of schema validation vs test running woes in another project right now...
Requiring it for un-configurable actions seemed remarkably trivial to me, but *sigh*
Comment #9
anton-staroverov commentedDefinitely need this patch to prevent confusion like #2749695-23: Thumbnail not updated. Also fixing link to "Thumbnail not updated".
Comment #10
ckaotikThis would still be a useful feature - is there any interest of porting this to Core media?
Comment #11
marcoscanoThe equivalent (and more generic) issue for this in core is #2983456: Expose triggering update of media metadata + thumbnail to end users
Comment #12
anybodyAs of #11