Error "OC_Image::fixOrientation(): No image loaded" when trying to open huge pixel jpg images (web)

Nextcloud version (eg, 20.0.5): 23.0.1
Operating system and version (eg, Ubuntu 20.04): 21.10
Apache or nginx version (eg, Apache 2.4.25): Apache
PHP version (eg, 7.4): 8.0.15

nc

Hello,

how do i fix this error, it gets triggered when showing a foto preview.

“OC_Image::fixOrientation(): No image loaded”

Some very big (30MB+) jpg images are not loaded. But they are not corrupted on my synced client.

Best Regards

Traszi

2 Likes

Another Update in this issue.

So after deleting all previews in the postgres database and the file system, nextcloud tried to regenerate all the previews.

I end up in the same state, some .jpg files have no preview and i cannot open them. On the other images, it workes perfectly.

Those are very big files pixel wise: like 7000x6000 px jpg images.

They trigger while loading the web file previews the above errors. When clicking on them, i see this:

nc1

I do not have user_usage_report app installed, i already found this old thread:
https://github.com/nextcloud/server/issues/21740 .

I would not really care so much about the preview, but not being able to show the image in the browser is bad, cause i use this a lot.

Those are very big files pixel wise: like 7000x6000 px jpg images.

Trying a push.

Can anyone confirm the problem with large pixel jpg images?

Yes, I have the same exact error. And I should point out that I don’t have the user_usage_report app too.

2 Likes

Hi,
i have exact the same error. Opening large image files not possible and no preview. I also dont use user_usage_report. I also tried installing the previewgenerator App from NC 22, but after reloading, NC23 forces to upgrade the previewgenerator. Hope they will fix it soon.

2 Likes

Hi,
I also have this problem and was able to find a pixel limit for it. The error occurs from an image size of about 33.5 megapixels. Everything up to 6689 x 5016 px works, from 6690 x 5016 px does not work anymore.
I still have Nextcloud instances with version 21.0.7, 22.2.3 and 23.0.0, there this error did not occur yet.
This error is present in versions 21.0.8, 21.0.9, 22.2.4, 22.2.5, 23.0.1 and 23.0.2.
When installing the faulty versions, the HASH error with the file “mimetypelist.js” also always occurred.

2 Likes

I have the same xact problem. All smaller jpegs, let’s say smaller than 8MB have previews and open without error. Problem begins with mages between 8MB - 12MB size. The larger the file, the more often it generates an error. But there is no jpeg file over 12MB with a preview. All bigger than 12MB generate errors. Also logs have a bunch of “Error core OC_Image::fixOrientation(): No image loaded”… Nextcloud Hub II (23.0.2)

1 Like

Please believe me! It has nothing to do with the file size!
If the image exceeds a certain number of pixels, it is no longer displayed.
Here is a nice example:
3840 x 2160 px (UHD) - the image is displayed
7680 x 4320 px (FUHD) - the picture is displayed
8192 x 4320 px (8K-DCI) - the picture is no longer displayed !?
The images have a size between 30 and 120 kB!
Test images

1 Like

Good Morning,

you’re right. The file size is irrelevant. I could reproduce this. The last Image with 8192x4320 px is not previewed and brings the error. Hmm… but how to fix?

1 Like

I do not have user_usage_report app installed, i already found this old thread:
https://github.com/nextcloud/server/issues/21740 .

On this old thread, there was statet a problem with user_usage_report app, but since i never had and don’t have it installed, i don’t really have a clue where to investigate further how to fix this.

I don’t know a fix, which was of course the motivation posting this problem. I hope some dev can have a closer look into this.

Do we need to open a bug ticket somewhere? What is the process we need to initiate? Or is it enough in the forum here.

Found this issue.

Works for me on Nextcloud 23.0.2.
Increase this value. i have tested it with 1280 :wink:

config/config.php:


  * max memory for generating image previews with imagegd (default behavior) 
  * Reads the image dimensions from the header and assumes 32 bits per pixel. 
  * If creating the image would allocate more memory, preview generation will 
  * be disabled and the default mimetype icon is shown. Set to -1 for no limit. 
  * 
  * Defaults to ``128`` megabytes 
  */ 
 'preview_max_memory' => 128,

'preview_max_memory' => 1280,

But i do not understand it.
Must the software really alloc all the memory?
“preview generation will be disabled”?
I used the small size images posted in zip file above from @Crashandy .

5 Likes

Confirm that this works. Thank you @devnull.
In my config.php there was not even an entry ‘preview_max_memory’… i added it.

1 Like

@devnull, that was exactly the solution!
Now I’ll put one more on top.
An image with 15360 x 8640 px (QUHD) and a size of about 400 kB.

QUHD Image

With the parameter ‘preview_max_memory’ => 512, this image is also displayed exactly. The prerequisite is sufficient working memory, which means that these images are not displayed in a hosted Nextcloud. I have an instance with 2 GB of RAM and an image with QUHD also works there.

Now the actually simple solution:
No matter what image content is present, the uncompressed image has a certain size. This size is obviously the basis of the processing in the preview and for the required memory for the display.

2022-02-18 Image sizes

So the sufficient parameter for this is: ‘preview_max_memory’ => 512,

2 Likes

I also testet the fix changing the parameter in the config.php. The value 256 also works for me.
Many thanks @devnull

2 Likes

Yes, your’re 100% right. I have one group of 64MPIX pictures with size of 9248x6936 or 6936x9248. This group produces always error and no previews.

After changing to ‘preview_max_memory’ => 512,
Server has crushed almost immediately while generating previews (4GB of memory).
So I have changed to ‘preview_max_memory’ => 256, and server memory to 8GB…
Still crushes but not immediately…
Do I have to tune some memory settings?.. I’m looking something in logs, no findings so far…

I have i high performant setup, with a lot of ram, i am probably not a good reference for you.
My instance runs in docker, i defined a custom php.ini where i adjusted the php memory limit.


php.ini
upload_max_filesize=20G
post_max_size=20G
memory_limit=16G

I’m not sure if the memory_limit from php is a problem here, but worth a try to adjust the parameter. Depending on your setup, you find a lot of topics in the forum how to adjust this memory limit.

I can jsut tell you that i set the preview value to “-1” and had no crashes, all my high-res-pictures load like a charm now.

1 Like

Hi, is the path /var/www/nextcloud/config/config.php ?
Cause in here I cant find any reference as you show.

1 Like

Sorry for the late respond.

The config right there: …/nextcloud/config/config.php.
I had to add the 'preview_max_memory' => 1280 at the end, it was not in my file already.

Do you have a docker installation? Then you can try
docker exec -it -u www-data name_of_your_nextcloud_docker_container php occ config:system:set preview_max_memory --value 1280

else if you know how to use occ you can use:
occ config:system:set preview_max_memory --value 1280

Hope it helps. Best wishes.