Fix Intervention Image “GD driver is only able to decode JPG, PNG, GIF or WebP files” error
Writing this because I just spent precious hours debugging this issue, trying to do the most, when the problem was so damn simple.
If you’re getting the error
Unsupported image type. GD driver is only able to decode JPG, PNG, GIF or WebP files. {“userId”:1,”exception”:”[object] (Intervention\\Image\\Exception\\NotReadableException(code: 0): Unsupported image type. GD driver is only able to decode JPG, PNG, GIF or WebP files
The fix for me was increasing the upload_max_filesize
andpost_max_size
in my php.ini
file to something large. Mine was initially set to 2M, so when I tried uploading images from my iPhone it was failing and I thought it was some high quality image issue 🤦🏾♂️
My guess is, that error is caused due to the post_max_size limit truncating the image data uploaded, hence, the truncated image being invalid. Anyway, this worked for me and I didn’t see this solution anywhere so I thought to share.
Let me know if this helps you.