croppa icon indicating copy to clipboard operation
croppa copied to clipboard

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

Open jordanade opened this issue 1 year ago • 3 comments

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 avatar Aug 26 '24 02:08 jordanade

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

jordanade avatar Aug 26 '24 11:08 jordanade

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

sdebacker avatar Aug 26 '24 15:08 sdebacker

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.

jordanade avatar Aug 28 '24 04:08 jordanade

OK, I created a PR in which I merged miking7's PR https://github.com/BKWLD/croppa/pull/210 with master. I also updated some comments and the README to reflect the tmp_disk config option.

I'm not familiar enough with mocking to know how to mock a AwsS3V3Adapter or other remote disk, so no test is provided.

https://github.com/BKWLD/croppa/pull/225

jordanade avatar Sep 30 '24 00:09 jordanade

Great, thank you.

sdebacker avatar Sep 30 '24 09:09 sdebacker