cms icon indicating copy to clipboard operation
cms copied to clipboard

[6.x] Asset video thumbnail generation

Open JohnathonKoster opened this issue 6 months ago • 3 comments

This PR adds the ability to automatically generate thumbnails for video assets within the Control Panel's asset browser.

Docs to come!

Closes https://github.com/statamic/ideas/issues/1120.

JohnathonKoster avatar Jun 04 '25 04:06 JohnathonKoster

Nice! Would it be possible to merge the hook data into the asset resource after merging the thumbnail data? That would be a simple way of allowing what PR #10594 was trying to accomplish, just via hooks. With the current order, there's no way of setting a custom thumbnail value for other asset types (e.g. PDFs) since the thumbnails method always returns ['thumbnail' => null] for non-image/video types and overwrites whatever was returned from the hook. Switching the order and merging the hook data after the thumbnail data would make that possible.

https://github.com/statamic/cms/blob/a90c7d26ff3cac3004b09c5c49a304463c4d72fe/src/Http/Resources/CP/Assets/FolderAsset.php#L89-L90

Or maybe add another explicit thumbnail hook, if that makes more sense?

daun avatar Jun 08 '25 14:06 daun

Nice! Would it be possible to merge the hook data into the asset resource after merging the thumbnail data? That would be a simple way of allowing what PR #10594 was trying to accomplish, just via hooks. With the current order, there's no way of setting a custom thumbnail value for other asset types (e.g. PDFs) since the thumbnails method always returns ['thumbnail' => null] for non-image/video types and overwrites whatever was returned from the hook. Switching the order and merging the hook data after the thumbnail data would make that possible.

https://github.com/statamic/cms/blob/a90c7d26ff3cac3004b09c5c49a304463c4d72fe/src/Http/Resources/CP/Assets/FolderAsset.php#L89-L90

Or maybe add another explicit thumbnail hook, if that makes more sense?

Love this! I've made an adjustment to how things are merged that will make it possible to override any thumbnail 🤘

JohnathonKoster avatar Jun 14 '25 16:06 JohnathonKoster

Amazing! Can't wait for this to land 🎊

daun avatar Jun 15 '25 14:06 daun

@JohnathonKoster is this ready for a review?

jackmcdade avatar Jul 01 '25 12:07 jackmcdade

@jackmcdade yup! Would love someone to take a look

JohnathonKoster avatar Jul 01 '25 12:07 JohnathonKoster