Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImagickException Failed to read the file #47289

Open
AndyXheli opened this issue Aug 16, 2024 · 11 comments
Open

ImagickException Failed to read the file #47289

AndyXheli opened this issue Aug 16, 2024 · 11 comments
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap 30-feedback bug dependencies feature: previews and thumbnails

Comments

@AndyXheli
Copy link

AndyXheli commented Aug 16, 2024

NC 30 RC1
Not running docker
Ubuntu 22.04
PHP 8.3
Redis
Apache2
imagemagick is already the newest version (8:6.9.11.60+dfsg-1.3ubuntu0.22.04.5+esm1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

{"reqId":"n5ZKVfuUurXDFGb6OnQF","level":3,"time":"2024-08-16T08:33:14-05:00","remoteAddr":"","user":"","app":"core","method":"GET","url":"/core/preview?fileId=1575189&x=250&y=250","message":"File: /username/files/Photos/2024/24-08-14 21-58-05 0598.heic Imagick says:","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36","version":"30.0.0.8","exception":{"Exception":"ImagickException","Message":"Failed to read the file","Code":1,"Trace":[{"file":"/var/www/nextcloud/lib/private/Preview/HEIC.php","line":99,"function":"pingImage","class":"Imagick","type":"->"},{"file":"/var/www/nextcloud/lib/private/Preview/HEIC.php","line":56,"function":"getResizedPreview","class":"OC\\Preview\\HEIC","type":"->"},{"file":"/var/www/nextcloud/lib/private/Preview/GeneratorHelper.php","line":44,"function":"getThumbnail","class":"OC\\Preview\\HEIC","type":"->"},{"file":"/var/www/nextcloud/lib/private/Preview/Generator.php","line":337,"function":"getThumbnail","class":"OC\\Preview\\GeneratorHelper","type":"->"},{"file":"/var/www/nextcloud/lib/private/Preview/Generator.php","line":313,"function":"generateProviderPreview","class":"OC\\Preview\\Generator","type":"->"},{"file":"/var/www/nextcloud/lib/private/Preview/Generator.php","line":119,"function":"getMaxPreview","class":"OC\\Preview\\Generator","type":"->"},{"file":"/var/www/nextcloud/lib/private/Preview/Generator.php","line":86,"function":"generatePreviews","class":"OC\\Preview\\Generator","type":"->"},{"file":"/var/www/nextcloud/lib/private/PreviewManager.php","line":167,"function":"getPreview","class":"OC\\Preview\\Generator","type":"->"},{"file":"/var/www/nextcloud/core/Controller/PreviewController.php","line":159,"function":"getPreview","class":"OC\\PreviewManager","type":"->"},{"file":"/var/www/nextcloud/core/Controller/PreviewController.php","line":123,"function":"fetchPreview","class":"OC\\Core\\Controller\\PreviewController","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":208,"function":"getPreviewByFileId","class":"OC\\Core\\Controller\\PreviewController","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":114,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":161,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":309,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":996,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/nextcloud/index.php","line":24,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/lib/private/Preview/HEIC.php","Line":99,"message":"File: /username/files/Photos/2024/24-08-14 21-58-05 0598.heic Imagick says:","exception":[],"CustomMessage":"File: /username/files/Photos/2024/24-08-14 21-58-05 0598.heic Imagick says:"},"id":"66bf552f2e150"}

image

Also nothing change on my system only nextcloud update so why are we getting this all of a sudden never had issue with HEIC photos before

when i open the photo
image

image

@AndyXheli
Copy link
Author

AndyXheli commented Aug 16, 2024

I’ve observed that on my iPhone running iOS 18 with the Nextcloud client version 5.5.4.13, having "Most Compatible" turned off and Live Photos enabled causes errors when uploading photos. However, when "Most Compatible" is turned on, everything works fine, and the photos are saved as JPEGs.

I also tested the same setup on my iPad, which isn’t on iOS 18, and with "Most Compatible" off, it works correctly. I’m wondering if iOS 18 has introduced changes to the HEIC format that are causing issues with Nextcloud uploads.

@hbprotoss
Copy link

similar situation here

NC 29 inside docker

photos uploaded by iOS 18 device, with "Most Compatible" turned off and Live Photos enabled

log reports

{"reqId":"IKURbZenu8VQKrMEBbxX","level":3,"time":"2024-08-20T07:37:35+00:00","remoteAddr":"220.189.193.180","user":"xxx","app":"core","method":"GET","url":"/apps/memories/api/image/preview/105406?c=7918f025dc0bde9b91f4633cfea852a6&x=3360&y=2100&a=1","message":"File: /xxx/files/Photos/IMG_1200.HEIC Imagick says:","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36","version":"29.0.4.1","exception":{"Exception":"ImagickException","Message":"Failed to read the file","Code":1,"Trace":[{"file":"/var/www/html/lib/private/Preview/HEIC.php","line":119,"function":"pingImage","class":"Imagick","type":"->","args":["/var/www/html/data/xxx/files/Photos/IMG_1200.HEIC[0]"]},{"file":"/var/www/html/lib/private/Preview/HEIC.php","line":76,"function":"getResizedPreview","class":"OC\\Preview\\HEIC","type":"->","args":["/var/www/html/data/xxx/files/Photos/IMG_1200.HEIC",4096,4096]},{"file":"/var/www/html/lib/private/Preview/GeneratorHelper.php","line":64,"function":"getThumbnail","class":"OC\\Preview\\HEIC","type":"->","args":[["OC\\Files\\Node\\File"],4096,4096]},{"file":"/var/www/html/lib/private/Preview/Generator.php","line":361,"function":"getThumbnail","class":"OC\\Preview\\GeneratorHelper","type":"->","args":[["OC\\Preview\\HEIC"],["OC\\Files\\Node\\File"],4096,4096]},{"file":"/var/www/html/lib/private/Preview/Generator.php","line":337,"function":"generateProviderPreview","class":"OC\\Preview\\Generator","type":"->","args":[["OC\\Files\\SimpleFS\\SimpleFolder"],["OC\\Files\\Node\\File"],4096,4096,false,true,"image/heic",""]},{"file":"/var/www/html/lib/private/Preview/Generator.php","line":143,"function":"getMaxPreview","class":"OC\\Preview\\Generator","type":"->","args":[["OC\\Files\\SimpleFS\\SimpleFolder"],[],["OC\\Files\\Node\\File"],"image/heic",""]},{"file":"/var/www/html/lib/private/Preview/Generator.php","line":110,"function":"generatePreviews","class":"OC\\Preview\\Generator","type":"->","args":[["OC\\Files\\Node\\File"],[[3360,2100,false,"fill"]],"image/heic"]},{"file":"/var/www/html/lib/private/PreviewManager.php","line":190,"function":"getPreview","class":"OC\\Preview\\Generator","type":"->","args":[["OC\\Files\\Node\\File"],3360,2100,false,"fill",null]},{"file":"/var/www/html/custom_apps/memories/lib/Controller/ImageController.php","line":62,"function":"getPreview","class":"OC\\PreviewManager","type":"->","args":[["OC\\Files\\Node\\File"],3360,2100,false,"fill"]},{"file":"/var/www/html/custom_apps/memories/lib/UtilController.php","line":20,"function":"OCA\\Memories\\Controller\\{closure}","class":"OCA\\Memories\\Controller\\ImageController","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/custom_apps/memories/lib/Controller/ImageController.php","line":55,"function":"guardEx","class":"OCA\\Memories\\Util","type":"::","args":[["Closure"]]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":232,"function":"preview","class":"OCA\\Memories\\Controller\\ImageController","type":"->","args":[105406,3360,2100,true,"fill"]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":138,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Memories\\Controller\\ImageController"],"preview"]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Memories\\Controller\\ImageController"],"preview"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":338,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Memories\\Controller\\ImageController","preview",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["105406","memories.image.preview"]]},{"file":"/var/www/html/lib/base.php","line":1050,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/memories/api/image/preview/105406"]},{"file":"/var/www/html/index.php","line":49,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/lib/private/Preview/HEIC.php","Line":119,"message":"File: /xxx/files/Photos/IMG_1200.HEIC Imagick says:","exception":{},"CustomMessage":"File: /xxx/files/Photos/IMG_1200.HEIC Imagick says:"}}

@AndyXheli
Copy link
Author

@hbprotoss i think is has to do with someone on ios18 and nextcloud iOS client. But let's see what happens! The iOS team can explain what's going on

@hbprotoss
Copy link

@hbprotoss i think is has to do with someone on ios18 and nextcloud iOS client. But let's see what happens! The iOS team can explain what's going on

the underlining lib has fixed the issue, hope nextcloud to update dep

https://github.com/strukturag/libheif/releases/tag/v1.18.0

@edm00se
Copy link

edm00se commented Aug 22, 2024

I had (attempted to) report this issue in nextcloud/previewgenerator#504, this appears to be the case for every heic photo (not screenshot or video) I've taken since moving up to the iOS 18 public beta. The link to the libheif is what I'd found as the most likely culprit as well.

I did not upload the images with the NC iOS app, so I doubt that's part of the issue.

@skjnldsv skjnldsv added bug 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Sep 3, 2024
@pavlohav
Copy link

pavlohav commented Sep 3, 2024

Looks like I am also running into this exact issue. Also running IOS 18.1 beta and am not able to view those HEIC photos in nextcloud.
Running NC AIO 9.4.1

@adrhc
Copy link

adrhc commented Sep 17, 2024

ImageMagick/ImageMagick#7627

heif-convert works but convert doesn't in Ubuntu 23.10

@destiny14
Copy link

I can confirm this issue with Nextcloud version 30.0.0.14 (Hub 9, Docker). HEIC files up to the iOS18 (stable) update are displayed correctly.

@hbprotoss
Copy link

I can confirm this issue with Nextcloud version 30.0.0.14 (Hub 9, Docker). HEIC files up to the iOS18 (stable) update are displayed correctly.

I have upgrade to 30.0.0.14, preview still not working for both old and new uploaded HEIC photos

@crazyfacka
Copy link

This issue is related with libheif, not supporting the latest format of the HEIC images. This has been fixed, but ImageMagick needs to be compiled against it. Not sure if this is ever going to be solved within Nextcloud.

I've created a Dockerfile to solve this temporarily, which builds on top of the Nextcloud community docker image. You can take ideas from here @ https://github.com/crazyfacka/dockerimages/blob/main/nextcloud/Dockerfile

@daro1337
Copy link

daro1337 commented Oct 7, 2024

Thanks @crazyfacka for sharing this. Your workaround works for me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap 30-feedback bug dependencies feature: previews and thumbnails
Projects
None yet
Development

No branches or pull requests