mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-24 23:35:23 +00:00
Update Media model, fix broken thumbnail/gray thumbnail bug
This commit is contained in:
parent
62ee6c78c8
commit
e33643c295
1 changed files with 19 additions and 17 deletions
|
@ -2,11 +2,11 @@
|
||||||
|
|
||||||
namespace App;
|
namespace App;
|
||||||
|
|
||||||
|
use App\Util\Media\License;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use App\Util\Media\License;
|
|
||||||
use Storage;
|
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
use Storage;
|
||||||
|
|
||||||
class Media extends Model
|
class Media extends Model
|
||||||
{
|
{
|
||||||
|
@ -21,7 +21,7 @@ class Media extends Model
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'srcset' => 'array',
|
'srcset' => 'array',
|
||||||
'deleted_at' => 'datetime'
|
'deleted_at' => 'datetime',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function status()
|
public function status()
|
||||||
|
@ -58,7 +58,7 @@ class Media extends Model
|
||||||
return url(Storage::url($this->thumbnail_path));
|
return url(Storage::url($this->thumbnail_path));
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->remote_media && !$this->thumbnail_path && $this->cdn_url) {
|
if (! $this->thumbnail_path && $this->cdn_url) {
|
||||||
return $this->cdn_url;
|
return $this->cdn_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,6 +81,7 @@ class Media extends Model
|
||||||
if (! $this->mime) {
|
if (! $this->mime) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return explode('/', $this->mime)[0];
|
return explode('/', $this->mime)[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,6 +105,7 @@ class Media extends Model
|
||||||
$verb = 'Document';
|
$verb = 'Document';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $verb;
|
return $verb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,7 +142,7 @@ class Media extends Model
|
||||||
return [
|
return [
|
||||||
'id' => $res['id'],
|
'id' => $res['id'],
|
||||||
'title' => $res['title'],
|
'title' => $res['title'],
|
||||||
'url' => $res['url']
|
'url' => $res['url'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue