[6.x] Fix video thumbnails showing as a broken image - #15291
Conversation
A stale or mistyped ffmpeg.binary path was treated as available, so video thumbnail URLs were still emitted and the CP hit failing requests.
A process-static cache could leave long-lived workers (e.g. Octane) stuck with a stale missing-binary result across requests.
Assert the video filetype SVG body, and cover video_thumbnails being disabled so Glide never tries to manipulate an MP4.
Laravel once() is instance-scoped and Ffmpeg is not a singleton, so each asset re-resolved the binary. Use a static cache cleared on Octane RequestReceived (and via clearBinaryCache) instead of Once::flush().
Browser Grid/Thumbnail already cleared a broken thumbnail URL on img error; Assets fieldtype tiles and rows did not, so failed video thumbs still showed as broken images there.
which/where can return a stale non-executable path; treat that the same as a missing binary so video thumbnail URLs are not emitted.
|
Hi, I think this change introduces a regression on hosting environments where After upgrading from Statamic 6.29 to 6.30, all Glide requests started returning HTTP 500, including requests for regular JPEG images. The exception was: The issue appears to be the order of this condition in if (ThumbnailExtractor::available() && $asset->isVideo()) {Because PHP evaluates conditions from left to right, Reversing the condition prevents FFmpeg detection for non-video assets: if ($asset->isVideo() && ThumbnailExtractor::available()) {For actual video assets, the FFmpeg availability check should also handle an unavailable or disabled The current workaround is: 'video_thumbnails' => false,This immediately restores all Glide image transformations. |
Description of the Problem
If you don't have
ffmpeginstalled (which is normal on macOS at least) you see a broken image when you upload a video, like belowI believe this behaviour was introduced in #11841
What this PR Does
Before: Videos always got a thumbnail URL; without FFmpeg that request 500’d → broken
.
After:
How to Reproduce
/cp/assetslocally on macOS and you'll probably get a broken thumbnail unless you've gone to the trouble of installing ffmpeg