Mimetype einer Datei im Template ermitteln
Ich versuche gerade den Minetype einer Datei zu ermitteln um mir einen eigenen RSCE Video Player daraus zu bauen.
Folgendes habe ich getan:
Ich hole mir die UUID jeder Datei aus $this->video
PHP-Code:
<?php foreach ($this->video as $uuid) {
$objFile = \FilesModel::findByUuid($uuid);
Wenn ich das jetzt dumpe, gibt es aber gar keinen Mimetype, auf den ich zugreifen könnte:
Code:
Contao\FilesModel {#1024 ?
#arrData: array:19 [?
"id" => 464
"pid" => b"þ\x0FÊl@a\x11ïµ°Ga\x10-±ñ"
"tstamp" => 1720797519
"uuid" => b"\x04˜±ú@b\x11ïµ°Ga\x10-±ñ"
"type" => "file"
"path" => "files/media/video/hero/1080p/PGB Hero 4.mp4"
"extension" => "mp4"
"hash" => "2bf3789c2a02b66fe7ab311975c15c1d"
"lastModified" => null
"found" => "1"
"name" => "PGB Hero 4.mp4"
"importantPartX" => 0.0
"importantPartY" => 0.0
"importantPartWidth" => 0.0
"importantPartHeight" => 0.0
"meta" => null
"ic_hide" => ""
"ic_href" => ""
"ic_copyright" => ""
]
Versuche ich mit der in der Doku zu findenen Funktion getMimeType den Mimetype auszulesen erhalte ich den Fehler "Attempted to call an undefined method named "getMimeType" of class "Contao\FilesModel"."
PHP-Code:
$mime = $objFile->getMimeType()
Was mache ich falsch?