Display CMS: Footer-Verlauf, Format-Hinweise und Switch-Fixes.
Blendet den B2IN-Text-Verlauf ohne Footer aus, zeigt 9:16-Format-Badges in der Mediathek, normalisiert Modul-Booleans und korrigiert Flux-Switches im Dark Mode. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
6c2da9bdac
commit
7491d20d39
14 changed files with 366 additions and 10 deletions
|
|
@ -33,6 +33,13 @@ class DisplayMediaService
|
|||
$metadata['width'] = $dimensions[0];
|
||||
$metadata['height'] = $dimensions[1];
|
||||
}
|
||||
} else {
|
||||
$dimensions = $this->readVideoDimensions($file->getRealPath());
|
||||
|
||||
if ($dimensions !== null) {
|
||||
$metadata['width'] = $dimensions['width'];
|
||||
$metadata['height'] = $dimensions['height'];
|
||||
}
|
||||
}
|
||||
|
||||
$media = DisplayMedia::create([
|
||||
|
|
@ -122,6 +129,43 @@ class DisplayMediaService
|
|||
return $process->isSuccessful() && is_file($thumbnailPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{width: int, height: int}|null
|
||||
*/
|
||||
private function readVideoDimensions(string $videoPath): ?array
|
||||
{
|
||||
$process = new Process([
|
||||
'ffprobe',
|
||||
'-v', 'error',
|
||||
'-select_streams', 'v:0',
|
||||
'-show_entries', 'stream=width,height',
|
||||
'-of', 'csv=s=x:p=0',
|
||||
$videoPath,
|
||||
]);
|
||||
$process->setTimeout(30);
|
||||
|
||||
try {
|
||||
$process->run();
|
||||
} catch (\Throwable) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $process->isSuccessful()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$dimensions = trim($process->getOutput());
|
||||
|
||||
if (! preg_match('/^(?<width>\d+)x(?<height>\d+)$/', $dimensions, $matches)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return [
|
||||
'width' => (int) $matches['width'],
|
||||
'height' => (int) $matches['height'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a DisplayMedia record from an external URL.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue