mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-29 09:43:16 +00:00
Update Media model
This commit is contained in:
parent
679a566466
commit
64f1118883
1 changed files with 23 additions and 0 deletions
|
@ -32,4 +32,27 @@ class Media extends Model
|
|||
|
||||
return url($url);
|
||||
}
|
||||
|
||||
public function mimeType()
|
||||
{
|
||||
return explode('/', $this->mime)[0];
|
||||
}
|
||||
|
||||
public function activityVerb()
|
||||
{
|
||||
$verb = 'Image';
|
||||
switch ($this->mimeType()) {
|
||||
case 'image':
|
||||
break;
|
||||
|
||||
case 'video':
|
||||
$verb = 'Video';
|
||||
break;
|
||||
|
||||
default:
|
||||
$verb = 'Document';
|
||||
break;
|
||||
}
|
||||
return $verb;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue