Skip to content

[6.x] Asset video thumbnail generation #11841

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: ui
Choose a base branch
from

Conversation

JohnathonKoster
Copy link
Contributor

@JohnathonKoster JohnathonKoster commented Jun 4, 2025

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

Docs to come!

Closes statamic/ideas#1120.

@JohnathonKoster JohnathonKoster marked this pull request as draft June 4, 2025 04:30
@JohnathonKoster JohnathonKoster marked this pull request as ready for review June 5, 2025 03:14
@daun
Copy link
Contributor

daun commented Jun 8, 2025

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.

$this->mergeWhen(! empty($hookData), $hookData),
$this->merge($this->thumbnails()),

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

This will allow people to customize the thumbnails much more easily
@JohnathonKoster
Copy link
Contributor Author

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.

$this->mergeWhen(! empty($hookData), $hookData),
$this->merge($this->thumbnails()),

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 🤘

@daun
Copy link
Contributor

daun commented Jun 15, 2025

Amazing! Can't wait for this to land 🎊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants