ariselseng / camerarawpreviews

Camera Raw Previews app for Nextcloud
GNU Affero General Public License v3.0
53 stars 11 forks source link

JPEG parameter struct mismatch: library thinks size is 624, caller expects 656 #54

Closed motodoros closed 4 years ago

motodoros commented 4 years ago

Hi!

I got following error on my NC. {"reqId":"vutjHWK0DJ5v8hlNY9TT","level":3,"time":"2020-10-22T07:23:19+00:00","remoteAddr":"192.168.88.1","user":"admin","app":"camerarawpreviews","method":"GET","url":"/index.php/core/preview?fileId=418301&c=0d17712978c9817c6d397921e769f2d3&x=188&y=188&forceIcon=0","message":{"Exception":"Intervention\Image\Exception\NotReadableException","Message":"Unable to read image from path (/tmp/708591019991d8bf1a76150d48d5c957.jpg).","Code":0,"Trace":[{"file":"/var/www/nextcloud/apps/camerarawpreviews/vendor/intervention/image/src/Intervention/Image/AbstractDecoder.php","line":339,"function":"initFromPath","class":"Intervention\Image\Imagick\Decoder","type":"->","args":["/tmp/708591019991d8bf1a76150d48d5c957.jpg"]},{"file":"/var/www/nextcloud/apps/camerarawpreviews/vendor/intervention/image/src/Intervention/Image/AbstractDriver.php","line":66,"function":"init","class":"Intervention\Image\AbstractDecoder","type":"->","args":["/tmp/708591019991d8bf1a76150d48d5c957.jpg"]},{"file":"/var/www/nextcloud/apps/camerarawpreviews/vendor/intervention/image/src/Intervention/Image/ImageManager.php","line":54,"function":"init","class":"Intervention\Image\AbstractDriver","type":"->","args":["/tmp/708591019991d8bf1a76150d48d5c957.jpg"]},{"file":"/var/www/nextcloud/apps/camerarawpreviews/vendor/intervention/image/src/Intervention/Image/ImageManagerStatic.php","line":58,"function":"make","class":"Intervention\Image\ImageManager","type":"->","args":["/tmp/708591019991d8bf1a76150d48d5c957.jpg"]},{"file":"/var/www/nextcloud/apps/camerarawpreviews/lib/RawPreviewBase.php","line":133,"function":"make","class":"Intervention\Image\ImageManagerStatic","type":"::","args":["/tmp/708591019991d8bf1a76150d48d5c957.jpg"]},{"file":"/var/www/nextcloud/apps/camerarawpreviews/lib/RawPreviewBase.php","line":61,"function":"getResizedPreview","class":"OCA\CameraRawPreviews\RawPreviewBase","type":"->","args":["/var/www/nextcloud/data/admin/files/Private/France (2019)/disneyland/RAW/_ASC6117.NEF",2048,2048]},{"file":"/var/www/nextcloud/apps/camerarawpreviews/lib/RawPreviewIProviderV2.php","line":25,"function":"getThumbnailInternal","class":"OCA\CameraRawPreviews\RawPreviewBase","type":"->","args":[{"class":"OC\Files\Node\File"},2048,2048]},{"file":"/var/www/nextcloud/lib/private/Preview/GeneratorHelper.php","line":63,"function":"getThumbnail","class":"OCA\CameraRawPreviews\RawPreviewIProviderV2","type":"->","args":[{"class":"OC\Files\Node\File"},2048,2048]},{"file":"/var/www/nextcloud/lib/private/Preview/Generator.php","line":241,"function":"getThumbnail","class":"OC\Preview\GeneratorHelper","type":"->","args":[{"class":"OCA\CameraRawPreviews\RawPreviewIProviderV2"},{"class":"OC\Files\Node\File"},2048,2048]},{"file":"/var/www/nextcloud/lib/private/Preview/Generator.php","line":141,"function":"getMaxPreview","class":"OC\Preview\Generator","type":"->","args":[{"class":"OC\Files\SimpleFS\SimpleFolder"},{"class":"OC\Files\Node\File"},"image/x-dcraw",""]},{"file":"/var/www/nextcloud/lib/private/Preview/Generator.php","line":107,"function":"generatePreviews","class":"OC\Preview\Generator","type":"->","args":[{"class":"OC\Files\Node\File"},[{"width":188,"height":188,"crop":true,"mode":"fill"}],"image/x-dcraw"]},{"file":"/var/www/nextcloud/lib/private/PreviewManager.php","line":190,"function":"getPreview","class":"OC\Preview\Generator","type":"->","args":[{"class":"OC\Files\Node\File"},188,188,true,"fill",null]},{"file":"/var/www/nextcloud/core/Controller/PreviewController.php","line":170,"function":"getPreview","class":"OC\PreviewManager","type":"->","args":[{"class":"OC\Files\Node\File"},188,188,true,"fill"]},{"file":"/var/www/nextcloud/core/Controller/PreviewController.php","line":143,"function":"fetchPreview","class":"OC\Core\Controller\PreviewController","type":"->","args":[{"class":"OC\Files\Node\File"},188,188,false,false,"fill"]},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":170,"function":"getPreviewByFileId","class":"OC\Core\Controller\PreviewController","type":"->","args":[418301,188,188,false,false,"fill"]},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":100,"function":"executeController","class":"OC\AppFramework\Http\Dispatcher","type":"->","args":[{"class":"OC\Core\Controller\PreviewController"},"getPreviewByFileId"]},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":137,"function":"dispatch","class":"OC\AppFramework\Http\Dispatcher","type":"->","args":[{"class":"OC\Core\Controller\PreviewController"},"getPreviewByFileId"]},{"file":"/var/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php","line":47,"function":"main","class":"OC\AppFramework\App","type":"::","args":["OC\Core\Controller\PreviewController","getPreviewByFileId",{"class":"OC\AppFramework\DependencyInjection\DIContainer"},{"_route":"core.Preview.getPreviewByFileId"}]},{"function":"invoke","class":"OC\AppFramework\Routing\RouteActionHandler","type":"->","args":[{"_route":"core.Preview.getPreviewByFileId"}]},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":297,"function":"call_user_func","args":[{"class":"OC\AppFramework\Routing\RouteActionHandler"},{"_route":"core.Preview.getPreviewByFileId"}]},{"file":"/var/www/nextcloud/lib/base.php","line":1011,"function":"match","class":"OC\Route\Router","type":"->","args":["/core/preview"]},{"file":"/var/www/nextcloud/index.php","line":37,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/nextcloud/apps/camerarawpreviews/vendor/intervention/image/src/Intervention/Image/Imagick/Decoder.php","Line":29,"Previous":{"Exception":"ImagickException","Message":"JPEG parameter struct mismatch: library thinks size is 624, caller expects 656 `/tmp/708591019991d8bf1a76150d48d5c957.jpg' @ error/jpeg.c/JPEGErrorHandler/322","Code":425,"Trace":[{"file":"/var/www/nextcloud/apps/camerarawpreviews/vendor/intervention/image/src/Intervention/Image/Imagick/Decoder.php","line":25,"function":"readimage","class":"Imagick","type":"->","args":["/tmp/708591019991d8bf1a76150d48d5c957.jpg"]},{"file":"/var/www/nextcloud/apps/camerarawpreviews/vendor/intervention/image/src/Intervention/Image/AbstractDecoder.php","line":339,"function":"initFromPath","class":"Intervention\Image\Imagick\Decoder","type":"->","args":["/tmp/708591019991d8bf1a76150d48d5c957.jpg"]},{"file":"/var/www/nextcloud/apps/camerarawpreviews/vendor/intervention/image/src/Intervention/Image/AbstractDriver.php","line":66,"function":"init","class":"Intervention\Image\AbstractDecoder","type":"->","args":["/tmp/708591019991d8bf1a76150d48d5c957.jpg"]},{"file":"/var/www/nextcloud/apps/camerarawpreviews/vendor/intervention/image/src/Intervention/Image/ImageManager.php","line":54,"function":"init","class":"Intervention\Image\AbstractDriver","type":"->","args":["/tmp/708591019991d8bf1a76150d48d5c957.jpg"]},{"file":"/var/www/nextcloud/apps/camerarawpreviews/vendor/intervention/image/src/Intervention/Image/ImageManagerStatic.php","line":58,"function":"make","class":"Intervention\Image\ImageManager","type":"->","args":["/tmp/708591019991d8bf1a76150d48d5c957.jpg"]},{"file":"/var/www/nextcloud/apps/camerarawpreviews/lib/RawPreviewBase.php","line":133,"function":"make","class":"Intervention\Image\ImageManagerStatic","type":"::","args":["/tmp/708591019991d8bf1a76150d48d5c957.jpg"]},{"file":"/var/www/nextcloud/apps/camerarawpreviews/lib/RawPreviewBase.php","line":61,"function":"getResizedPreview","class":"OCA\CameraRawPreviews\RawPreviewBase","type":"->","args":["/var/www/nextcloud/data/admin/files/Private/France (2019)/disneyland/RAW/_ASC6117.NEF",2048,2048]},{"file":"/var/www/nextcloud/apps/camerarawpreviews/lib/RawPreviewIProviderV2.php","line":25,"function":"getThumbnailInternal","class":"OCA\CameraRawPreviews\RawPreviewBase","type":"->","args":[{"class":"OC\Files\Node\File"},2048,2048]},{"file":"/var/www/nextcloud/lib/private/Preview/GeneratorHelper.php","line":63,"function":"getThumbnail","class":"OCA\CameraRawPreviews\RawPreviewIProviderV2","type":"->","args":[{"class":"OC\Files\Node\File"},2048,2048]},{"file":"/var/www/nextcloud/lib/private/Preview/Generator.php","line":241,"function":"getThumbnail","class":"OC\Preview\GeneratorHelper","type":"->","args":[{"class":"OCA\CameraRawPreviews\RawPreviewIProviderV2"},{"class":"OC\Files\Node\File"},2048,2048]},{"file":"/var/www/nextcloud/lib/private/Preview/Generator.php","line":141,"function":"getMaxPreview","class":"OC\Preview\Generator","type":"->","args":[{"class":"OC\Files\SimpleFS\SimpleFolder"},{"class":"OC\Files\Node\File"},"image/x-dcraw",""]},{"file":"/var/www/nextcloud/lib/private/Preview/Generator.php","line":107,"function":"generatePreviews","class":"OC\Preview\Generator","type":"->","args":[{"class":"OC\Files\Node\File"},[{"width":188,"height":188,"crop":true,"mode":"fill"}],"image/x-dcraw"]},{"file":"/var/www/nextcloud/lib/private/PreviewManager.php","line":190,"function":"getPreview","class":"OC\Preview\Generator","type":"->","args":[{"class":"OC\Files\Node\File"},188,188,true,"fill",null]},{"file":"/var/www/nextcloud/core/Controller/PreviewController.php","line":170,"function":"getPreview","class":"OC\PreviewManager","type":"->","args":[{"class":"OC\Files\Node\File"},188,188,true,"fill"]},{"file":"/var/www/nextcloud/core/Controller/PreviewController.php","line":143,"function":"fetchPreview","class":"OC\Core\Controller\PreviewController","type":"->","args":[{"class":"OC\Files\Node\File"},188,188,false,false,"fill"]},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":170,"function":"getPreviewByFileId","class":"OC\Core\Controller\PreviewController","type":"->","args":[418301,188,188,false,false,"fill"]},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":100,"function":"executeController","class":"OC\AppFramework\Http\Dispatcher","type":"->","args":[{"class":"OC\Core\Controller\PreviewController"},"getPreviewByFileId"]},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":137,"function":"dispatch","class":"OC\AppFramework\Http\Dispatcher","type":"->","args":[{"class":"OC\Core\Controller\PreviewController"},"getPreviewByFileId"]},{"file":"/var/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php","line":47,"function":"main","class":"OC\AppFramework\App","type":"::","args":["OC\Core\Controller\PreviewController","getPreviewByFileId",{"class":"OC\AppFramework\DependencyInjection\DIContainer"},{"_route":"core.Preview.getPreviewByFileId"}]},{"function":"invoke","class":"OC\AppFramework\Routing\RouteActionHandler","type":"->","args":[{"_route":"core.Preview.getPreviewByFileId"}]},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":297,"function":"call_user_func","args":[{"class":"OC\AppFramework\Routing\RouteActionHandler"},{"_route":"core.Preview.getPreviewByFileId"}]},{"file":"/var/www/nextcloud/lib/base.php","line":1011,"function":"match","class":"OC\Route\Router","type":"->","args":["/core/preview"]},{"file":"/var/www/nextcloud/index.php","line":37,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/nextcloud/apps/camerarawpreviews/vendor/intervention/image/src/Intervention/Image/Imagick/Decoder.php","Line":25},"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36","version":"19.0.4.2","id":"5f9133680e6cd"}

Each time I enter directory with RAW files, NC generates multiple errors above.

What I did before? So I really love this app and I used to use it recently. Everything was fine. But I decided to improve my previews (not cameraraws previews, but default NC previews), I wanted to decrease disk space that used by NC. So, I deleted all previews, and reconfigured it as it is said in this article https://ownyourbits.com/2019/06/29/understanding-and-improving-nextcloud-previews/ After this I started generating new previews and now my previews are 7 gb (It was 100+Gb before configuring). But camerarawpreviews not working after this =(

What can I do?

motodoros commented 4 years ago

Formated log


Intervention\Image\Exception\NotReadableException: Unable to read image from path (/tmp/fb8b867fc9a438ee089dde105bbb7d03.jpg).
/var/www/nextcloud/apps/camerarawpreviews/vendor/intervention/image/src/Intervention/Image/AbstractDecoder.php - line 339:

Intervention\Image\Imagick\Decoder->initFromPath("/tmp/fb8b86 ... g")

/var/www/nextcloud/apps/camerarawpreviews/vendor/intervention/image/src/Intervention/Image/AbstractDriver.php - line 66:

Intervention\Image\AbstractDecoder->init("/tmp/fb8b86 ... g")

/var/www/nextcloud/apps/camerarawpreviews/vendor/intervention/image/src/Intervention/Image/ImageManager.php - line 54:

Intervention\Image\AbstractDriver->init("/tmp/fb8b86 ... g")

/var/www/nextcloud/apps/camerarawpreviews/vendor/intervention/image/src/Intervention/Image/ImageManagerStatic.php - line 58:

Intervention\Image\ImageManager->make("/tmp/fb8b86 ... g")

/var/www/nextcloud/apps/camerarawpreviews/lib/RawPreviewBase.php - line 133:

Intervention\Image\ImageManagerStatic::make("/tmp/fb8b86 ... g")

/var/www/nextcloud/apps/camerarawpreviews/lib/RawPreviewBase.php - line 61:

OCA\CameraRawPreviews\RawPreviewBase->getResizedPreview("/var/www/ne ... F", 2048, 2048)

/var/www/nextcloud/apps/camerarawpreviews/lib/RawPreviewIProviderV2.php - line 25:

OCA\CameraRawPreviews\RawPreviewBase->getThumbnailInternal(OC\Files\Node\File {}, 2048, 2048)

/var/www/nextcloud/lib/private/Preview/GeneratorHelper.php - line 63:

OCA\CameraRawPreviews\RawPreviewIProviderV2->getThumbnail(OC\Files\Node\File {}, 2048, 2048)

/var/www/nextcloud/lib/private/Preview/Generator.php - line 241:

OC\Preview\GeneratorHelper->getThumbnail(OCA\CameraRa ... {}, OC\Files\Node\File {}, 2048, 2048)

/var/www/nextcloud/lib/private/Preview/Generator.php - line 141:

OC\Preview\Generator->getMaxPreview(OC\Files\Sim ... {}, OC\Files\Node\File {}, "image/x-dcraw", "")

/var/www/nextcloud/lib/private/Preview/Generator.php - line 107:

OC\Preview\Generator->generatePreviews(OC\Files\Node\File {}, [ { width: 1 ... }], "image/x-dcraw")

/var/www/nextcloud/lib/private/PreviewManager.php - line 190:

OC\Preview\Generator->getPreview(OC\Files\Node\File {}, 188, 188, true, "fill", null)

/var/www/nextcloud/core/Controller/PreviewController.php - line 170:

OC\PreviewManager->getPreview(OC\Files\Node\File {}, 188, 188, true, "fill")

/var/www/nextcloud/core/Controller/PreviewController.php - line 143:

OC\Core\Controller\PreviewController->fetchPreview(OC\Files\Node\File {}, 188, 188, false, false, "fill")

/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 170:

OC\Core\Controller\PreviewController->getPreviewByFileId(920416, 188, 188, false, false, "fill")

/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 100:

OC\AppFramework\Http\Dispatcher->executeController(OC\Core\Cont ... {}, "getPreviewByFileId")

/var/www/nextcloud/lib/private/AppFramework/App.php - line 137:

OC\AppFramework\Http\Dispatcher->dispatch(OC\Core\Cont ... {}, "getPreviewByFileId")

/var/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php - line 47:

OC\AppFramework\App::main("OC\\Core\\C ... r", "getPreviewByFileId", OC\AppFramew ... {}, { _route: "c ... "})

<<closure>>

OC\AppFramework\Routing\RouteActionHandler->__invoke({ _route: "c ... "})

/var/www/nextcloud/lib/private/Route/Router.php - line 297:

call_user_func(OC\AppFramew ... {}, { _route: "c ... "})

/var/www/nextcloud/lib/base.php - line 1011:

OC\Route\Router->match("/core/preview")

/var/www/nextcloud/index.php - line 37:

OC::handleRequest()

По причинеImagickException: JPEG parameter struct mismatch: library thinks size is 624, caller expects 656 `/tmp/fb8b867fc9a438ee089dde105bbb7d03.jpg' @ error/jpeg.c/JPEGErrorHandler/322
/var/www/nextcloud/apps/camerarawpreviews/vendor/intervention/image/src/Intervention/Image/Imagick/Decoder.php - line 25:

Imagick->readimage("/tmp/fb8b86 ... g")

/var/www/nextcloud/apps/camerarawpreviews/vendor/intervention/image/src/Intervention/Image/AbstractDecoder.php - line 339:

Intervention\Image\Imagick\Decoder->initFromPath("/tmp/fb8b86 ... g")

/var/www/nextcloud/apps/camerarawpreviews/vendor/intervention/image/src/Intervention/Image/AbstractDriver.php - line 66:

Intervention\Image\AbstractDecoder->init("/tmp/fb8b86 ... g")

/var/www/nextcloud/apps/camerarawpreviews/vendor/intervention/image/src/Intervention/Image/ImageManager.php - line 54:

Intervention\Image\AbstractDriver->init("/tmp/fb8b86 ... g")

/var/www/nextcloud/apps/camerarawpreviews/vendor/intervention/image/src/Intervention/Image/ImageManagerStatic.php - line 58:

Intervention\Image\ImageManager->make("/tmp/fb8b86 ... g")

/var/www/nextcloud/apps/camerarawpreviews/lib/RawPreviewBase.php - line 133:

Intervention\Image\ImageManagerStatic::make("/tmp/fb8b86 ... g")

/var/www/nextcloud/apps/camerarawpreviews/lib/RawPreviewBase.php - line 61:

OCA\CameraRawPreviews\RawPreviewBase->getResizedPreview("/var/www/ne ... F", 2048, 2048)

/var/www/nextcloud/apps/camerarawpreviews/lib/RawPreviewIProviderV2.php - line 25:

OCA\CameraRawPreviews\RawPreviewBase->getThumbnailInternal(OC\Files\Node\File {}, 2048, 2048)

/var/www/nextcloud/lib/private/Preview/GeneratorHelper.php - line 63:

OCA\CameraRawPreviews\RawPreviewIProviderV2->getThumbnail(OC\Files\Node\File {}, 2048, 2048)

/var/www/nextcloud/lib/private/Preview/Generator.php - line 241:

OC\Preview\GeneratorHelper->getThumbnail(OCA\CameraRa ... {}, OC\Files\Node\File {}, 2048, 2048)

/var/www/nextcloud/lib/private/Preview/Generator.php - line 141:

OC\Preview\Generator->getMaxPreview(OC\Files\Sim ... {}, OC\Files\Node\File {}, "image/x-dcraw", "")

/var/www/nextcloud/lib/private/Preview/Generator.php - line 107:

OC\Preview\Generator->generatePreviews(OC\Files\Node\File {}, [ { width: 1 ... }], "image/x-dcraw")

/var/www/nextcloud/lib/private/PreviewManager.php - line 190:

OC\Preview\Generator->getPreview(OC\Files\Node\File {}, 188, 188, true, "fill", null)

/var/www/nextcloud/core/Controller/PreviewController.php - line 170:

OC\PreviewManager->getPreview(OC\Files\Node\File {}, 188, 188, true, "fill")

/var/www/nextcloud/core/Controller/PreviewController.php - line 143:

OC\Core\Controller\PreviewController->fetchPreview(OC\Files\Node\File {}, 188, 188, false, false, "fill")

/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 170:

OC\Core\Controller\PreviewController->getPreviewByFileId(920416, 188, 188, false, false, "fill")

/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 100:

OC\AppFramework\Http\Dispatcher->executeController(OC\Core\Cont ... {}, "getPreviewByFileId")

/var/www/nextcloud/lib/private/AppFramework/App.php - line 137:

OC\AppFramework\Http\Dispatcher->dispatch(OC\Core\Cont ... {}, "getPreviewByFileId")

/var/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php - line 47:

OC\AppFramework\App::main("OC\\Core\\C ... r", "getPreviewByFileId", OC\AppFramew ... {}, { _route: "c ... "})

<<closure>>

OC\AppFramework\Routing\RouteActionHandler->__invoke({ _route: "c ... "})

/var/www/nextcloud/lib/private/Route/Router.php - line 297:

call_user_func(OC\AppFramew ... {}, { _route: "c ... "})

/var/www/nextcloud/lib/base.php - line 1011:

OC\Route\Router->match("/core/preview")

/var/www/nextcloud/index.php - line 37:

OC::handleRequest()
ariselseng commented 4 years ago

@motodoros can you send me a sample image that I can test locally for myself? And also can you tell me a bit about your web server?

motodoros commented 4 years ago

@ariselseng Server ubuntu 18.0.4LTS CPU: 6 cores RAM: 8GB

webserver - apache database - postgres php version: 7.3.23 php memory: 6 GB php max exec time: 3600 php max send size: 2 MB imagick module version => 3.4.4

I tried this for any RAW file, and every time I get same error.

_ASC6532.zip

ariselseng commented 4 years ago

@motodoros I just tested the file on my machine and it works great. After a little googling it seems it could happen if you have multiple libjpeg installed. You could also try to remove php-gd extension. It is worth a shot.

motodoros commented 4 years ago

@ariselseng

I recently installed new extention "facerecognition" to my NC. So, I built pdlib and added this string to php.ini file:

[pdlib]
extension="pdlib.so"

After commenting this string, camerarawpreview starts working without errors.

WTF? As I understand pdlib.so uses different versions of jpeg modules and loads it to php. Do u know how to avoid it?

ariselseng commented 4 years ago

I have no idea if it's possible. You could maybe remove imagick and only use GD. Worth a shot.