diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2021-10-25 16:13:50 +0200 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2021-10-28 17:48:43 +0200 |
commit | 36317896513ce229938d3cba96d32db19d2510d2 (patch) | |
tree | 5897796dc942200e8fb7fd02b2d8672573917bf2 /lib/private/Avatar | |
parent | df4e6bab6938287e7c0a876bdeacb7e0d8617723 (diff) | |
download | nextcloud-server-36317896513ce229938d3cba96d32db19d2510d2.tar.gz nextcloud-server-36317896513ce229938d3cba96d32db19d2510d2.zip |
Fix resource usages in OC_Image
This makes sure using resource or GdImage (PHP>=8) behaves the same.
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'lib/private/Avatar')
-rw-r--r-- | lib/private/Avatar/UserAvatar.php | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/private/Avatar/UserAvatar.php b/lib/private/Avatar/UserAvatar.php index 027c83172c2..b46e4816fa2 100644 --- a/lib/private/Avatar/UserAvatar.php +++ b/lib/private/Avatar/UserAvatar.php @@ -122,7 +122,7 @@ class UserAvatar extends Avatar { /** * Returns an image from several sources. * - * @param IImage|resource|string $data An image object, imagedata or path to the avatar + * @param IImage|resource|string|\GdImage $data An image object, imagedata or path to the avatar * @return IImage */ private function getAvatarImage($data) { @@ -131,7 +131,10 @@ class UserAvatar extends Avatar { } $img = new OC_Image(); - if (is_resource($data) && get_resource_type($data) === 'gd') { + if ( + (is_resource($data) && get_resource_type($data) === 'gd') || + (is_object($data) && get_class($data) === \GdImage::class) + ) { $img->setResource($data); } elseif (is_resource($data)) { $img->loadFromFileHandle($data); |