BKWLD / croppa

Image thumbnail creation through specially formatted URLs for Laravel.
MIT License
492 stars 91 forks source link

[Croppa 7] Intervention \ Image \ Exceptions \ DecoderException "Unable to decode input" when using remote src_disk #223

Open jordanade opened 2 weeks ago

jordanade commented 2 weeks ago

I got this error when loading, e.g. the following crop: 66cbdcaf5fd9f-600x600.jpeg

Here's a partial stack trace:

Unable to decode input {"exception":"[object] (Intervention\\Image\\Exceptions\\DecoderException(code: 0): Unable to decode input at /Users/jordan/Projects/jottful/vendor/intervention/image/src/InputHandler.php:109)
[stacktrace]
#0 /Users/jordan/Projects/jottful/vendor/intervention/image/src/Drivers/AbstractDriver.php(56): Intervention\\Image\\InputHandler->handle('https://jottful...')
#1 /Users/jordan/Projects/jottful/vendor/intervention/image/src/ImageManager.php(85): Intervention\\Image\\Drivers\\AbstractDriver->handleInput('https://jottful...', Array)
#2 /Users/jordan/Projects/jottful/vendor/bkwld/croppa/src/Image.php(44): Intervention\\Image\\ImageManager->read('https://jottful...')
#3 /Users/jordan/Projects/jottful/vendor/bkwld/croppa/src/Handler.php(106): Bkwld\\Croppa\\Image->__construct('https://jottful...', Array)
#4 /Users/jordan/Projects/jottful/vendor/bkwld/croppa/src/Handler.php(60): Bkwld\\Croppa\\Handler->render('images/2943/66c...')
…
jordanade commented 2 weeks ago

It appears the issue happens when 'src_disk' is set to 's3'. When converting a local file it works. According to Intervention Image 3 docs:

It is no longer possible to create images from an URI directly. The data must first be loaded by a dedicated HTTP client and then passed to the image library. Intervention Image is not responsible for HTTP client operations.

https://image.intervention.io/v3/introduction/upgrade

sdebacker commented 2 weeks ago

Ok, I wasn't aware of this change. Could you make a pull request with tests to fix this?

jordanade commented 2 weeks ago

Ok, I wasn't aware of this change. Could you make a pull request with tests to fix this?

Hi @sdebacker. It appears that this existing pull request addressing a different issue would solve this problem as well.