Add support .webp for avatar
This commit is contained in:
parent
29d9db3727
commit
469436ad1b
3 changed files with 4 additions and 2 deletions
|
@ -941,7 +941,6 @@ class Files
|
|||
if (\is_array($file['tmp_name'])) {
|
||||
$result = [];
|
||||
foreach ($file['tmp_name'] as $key => $value) {
|
||||
// изображение не было отправлено
|
||||
if (
|
||||
'' === $file['name'][$key]
|
||||
&& empty($file['size'][$key])
|
||||
|
|
|
@ -132,6 +132,9 @@ class Image extends File
|
|||
case 'gif':
|
||||
$result = @\imagegif($this->image, $path);
|
||||
break;
|
||||
case 'webp':
|
||||
$result = @\imagewebp($this->image, $path, $this->quality);
|
||||
break;
|
||||
default:
|
||||
$this->error = 'File type not supported';
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ class Edit extends Profile
|
|||
|
||||
if ($v->upload_avatar instanceof Image) {
|
||||
$name = $this->c->Secury->randomPass(8);
|
||||
$path = $this->c->DIR_PUBLIC . "{$this->c->config->o_avatars_dir}/{$name}.(jpg|png|gif)";
|
||||
$path = $this->c->DIR_PUBLIC . "{$this->c->config->o_avatars_dir}/{$name}.(jpg|png|gif|webp)";
|
||||
$result = $v->upload_avatar
|
||||
->rename(true)
|
||||
->rewrite(false)
|
||||
|
|
Loading…
Add table
Reference in a new issue