I ran into the same issue when trying to change the album cover image in SP Easy Image Gallery on Joomla 5:
imagecopyresampled(): Argument #2 ($src_image) must be of type GdImage, string given
Here's how I fixed it:
Enabled WebP support in Joomla:
Go to:
System > Global Configuration > Media
Add "webp" to the list of allowed file extensions:
webp
And also add the MIME type:
image/webp
Modified the gallery helper file:
Path:
/administrator/components/com_speasyimagegallery/helpers/speasyimagegallery.php
In the createThumbs() function, I added WebP support.
For loading WebP images, I added:
case 'webp': $img = imagecreatefromwebp($src); break;
For saving thumbnails as WebP:
case 'webp': imagewebp($new, $dest); break;
Verified that PHP has GD with WebP support (you can check this using phpinfo()).
After this fix, everything works fine — for JPG, PNG, and WebP.
You can see it live on my site:
https://glomontu.cz
Hope this helps others too.