public function MediaFile::__construct in MediaFront 7.2
File
- ./
MediaFile.php, line 25
Class
Code
public function __construct($file) {
// Check to make sure it is set.
if (!empty($file)) {
// Standardize the type of the incoming data.
$file = gettype($file) == 'string' ? array(
'path' => $file,
) : $file;
$file = (object) $file;
// Set the file object.
$this->file = $file;
// Get the full file path.
$this->path = $this
->getPath($file);
// Get the extension.
$this->extension = empty($file->extension) ? $this
->getExt() : $file->extension;
// Get the filemime.
$this->mimetype = $this
->getMimeType($file);
// Get the type for this media.
$this->type = $this
->getType();
// Get the class for the media.
$this->class = $this
->getClass();
// Get the mediaType.
$this->mediaType = !empty($file->mediaType) ? $file->mediaType : $this->class;
}
}