mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 06:21:27 +00:00
Update Media model
This commit is contained in:
parent
3b7127ba32
commit
fb24f382c0
1 changed files with 17 additions and 2 deletions
|
@ -19,8 +19,12 @@ class Media extends Model
|
|||
|
||||
public function url()
|
||||
{
|
||||
$path = $this->media_path;
|
||||
$url = Storage::url($path);
|
||||
if(!empty($this->remote_media) && $this->remote_url) {
|
||||
$url = $this->remote_url;
|
||||
} else {
|
||||
$path = $this->media_path;
|
||||
$url = Storage::url($path);
|
||||
}
|
||||
|
||||
return url($url);
|
||||
}
|
||||
|
@ -60,4 +64,15 @@ class Media extends Model
|
|||
{
|
||||
return json_decode($this->metadata, true, 3);
|
||||
}
|
||||
|
||||
public function getModel()
|
||||
{
|
||||
if(empty($this->metadata)) {
|
||||
return false;
|
||||
}
|
||||
$meta = $this->getMetadata();
|
||||
if($meta && isset($meta['Model'])) {
|
||||
return $meta['Model'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue