How to resolve when you face “Error loading xxx.jpg” on Nextcloud? 

Container



I faced problem when I intended to see some image files on Nextcloud as preview.
Android application and Chrome browser behaved the same.



Nextcloud helped me to resolve.
Especially this parts.

{"Exception":"Error","Message":"imagecreatefromstring(): No JPEG support in this PHP build at /var/www/html/lib/private/legacy/OC_Image.php#668","Code":0,"Trace":



I searched in Google and found solution.
GD library for image file doesn’t support jpeg.

I checked and exactly jpeg doesn’t exist.

php -i | grep -A 15 gd
(snip)
gd

GD Support => enabled
GD Version => bundled (2.1.0 compatible)
GIF Read Support => enabled
GIF Create Support => enabled
PNG Support => enabled
libPNG Version => 1.6.36
WBMP Support => enabled
XBM Support => enabled
BMP Support => enabled
TGA Read Support => enabled

Directive => Local Value => Master Value
gd.jpeg_ignore_warning => 1 => 1
(snip)




I solved by doing this.
– I added freetype/WebP too.

docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp
docker-php-ext-install gd



Let’s check.
First of all, php -i shows JPEG Support, FreeType Support and WebP Support as expected.

php -i | grep -A 20 gd
 (snip)
gd

GD Support => enabled
GD Version => bundled (2.1.0 compatible)
FreeType Support => enabled
FreeType Linkage => with freetype
FreeType Version => 2.9.1
GIF Read Support => enabled
GIF Create Support => enabled
JPEG Support => enabled
libJPEG Version => 6b
PNG Support => enabled
libPNG Version => 1.6.36
WBMP Support => enabled
XBM Support => enabled
WebP Support => enabled
BMP Support => enabled
TGA Read Support => enabled

Directive => Local Value => Master Value
gd.jpeg_ignore_warning => 1 => 1



Next check again with image files which actually faced error.
Yes, it’s fine!

Conclusion

How was it?

I hope this article will help you! 

Comments

Copied title and URL