On my development server everything works great, the images I upload via a form are converted with
Image::make($img)->encode('webp');
and when I go to check it, it's perfect.
On my production server things are a bit different, for example if I upload a square image (completely red), after the encoding I end up with a brownish/gold image and with other images I end up with an empty space.
Since the image is being created, I think there's a problem just with the encoding, maybe some configuration I missed..
Version of GD library on dev server is 2.4.1 and on production 2.1.1
Everything runs on Ubuntu 17.10 on dev and 16.04 production.
Laravel version 5.5
EDIT
PHP version 7.0 on both dev and production
EDIT 2
This is the kind of image that comes out
Ok, I might have done something wrong (more experienced people, please correct me) but I got it working.
I am on Ubuntu 16.04 LTS and the only available package for libgd-dev is 2.1.1 so this is what I've done to upgrade it:
downloaded these packages from https://packages.ubuntu.com/artful/amd64/{name-of-the-package}/download
zlib1g_1.2.11.dfsg-0ubuntu2_amd64.deb
zlib1g-dev_1.2.11.dfsg-0ubuntu2_amd64.deb
libwebp6_0.6.0-3_amd64.deb
libpng16-16_1.6.34-1_amd64.deb
libgd3_2.2.5-3_amd64.deb
libgd-dev_2.2.5-3_amd64.deb
I installed them in the order that I listed them in, however I simply saw which dependency dpkg was complaining about and installed it.
The image encoding code now works flawlessly