pulsejet / memories

Fast, modern and advanced photo management suite. Runs as a Nextcloud app.
https://memories.gallery
GNU Affero General Public License v3.0
2.82k stars 76 forks source link

HEIC wrongly orientated on preview but not on actual file #1120

Closed AiroPi closed 1 month ago

AiroPi commented 1 month ago

Describe the bug Some of my HEIC files are wrongly oriented in the timeline view and in the fullscreen view, but they got correctly oriented when I zoom in (when the image is fully loaded)

To Reproduce These files, for example, have this strange behavior: Archive.zip

Platform:

pulsejet commented 1 month ago

These look fine to me. Did you upload them to Nextcloud a long time ago? I think the HEIC orientation bug was fixed in Nextcloud 27, so you might need a preview regeneration (I plan to add this).

Can you try to re-upload the files to a different folder and see if that fixes it?

image

AiroPi commented 1 month ago

Still the same problem, but maybe the preview is cached and it detects it is the same photo somehow. https://cloud.schauli.com/apps/memories/s/tq9NpMSXCQC6bSK

AiroPi commented 1 month ago

I ran the command php occ preview:generate <path>, it tells "preview generated", but it is still wrongly oriented in my browser.

pulsejet commented 1 month ago

Hmm what version of Imagick do you have? The Memories admin panel should show this

AiroPi commented 1 month ago

Can't see imagick version on memories admin settings. I use Nextcloud AIO, with the imaginary extension:

Imaginary (for previews of heic, heif, illustrator, pdf, svg, tiff and webp.)

But here is some informations I was able to find:

imagick

imagick module => enabled
imagick module version => 3.7.0
imagick classes => Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator, ImagickKernel
Imagick compiled with ImageMagick version => ImageMagick 7.1.1-26 Q16-HDRI x86_64 21914 https://imagemagick.org
Imagick using ImageMagick library version => ImageMagick 7.1.1-26 Q16-HDRI x86_64 21914 https://imagemagick.org
pulsejet commented 1 month ago

I use Nextcloud AIO, with the imaginary extension

Ah, that's the problem. Get rid of imaginary, it doesn't work right with HEIC and is mostly useless anyway (actually slower for me compared to the default preview pipeline)

AiroPi commented 1 month ago

I won't run into any issue with other formats by doing this ? (It is said that imaginary is used to generate preview for other files like pdf...) I will disable it anyway if it fix the problem for my HEIC pictures, which is the most important for now.

pulsejet commented 1 month ago

I don't think it's used for anything other than images. Not sure though.

pulsejet commented 1 month ago

Closing this cause we can't fix it here and it's a confirmed upstream bug

AiroPi commented 1 month ago

I know this is not really memories-related, but by disabling imaginary, I can't generate preview for HEIC at all on an AIO instance. What is the tool normally used to generate preview for HEIC files ?

image
pulsejet commented 1 month ago

Did you enable HEIC in the admin panel of memories? Imagick is used for this

AiroPi commented 1 month ago

Did you enable HEIC in the admin panel of memories? Imagick is used for this

I haven't any option for this. Maybe Imagick isn't available through AIO, I don't know. I guess the menu should be "File Support" as it appear in the table of content, but there is nothing in the settings.

pulsejet commented 1 month ago

Huh is that the only missing section? It should be something like this. Any errors in JS console?

image

AiroPi commented 1 month ago

@pulsejet I get this : AdminMain.vue:107 TypeError: this.providers(...).includes is not a function

pulsejet commented 1 month ago

Fix is on the way. In the meanwhile, you can either add the two lines in this patch (https://github.com/pulsejet/memories/commit/3f652d139f110a0aeb20e454f3404233a8d2a813) to AdminController.php OR reformat your config.php as follows:

Replace

'enabledPreviewProviders' =>
  array (
    0 => 'OC\\Preview\\TXT',
    1 => 'OC\\Preview\\MarkDow
     ...
);

with

  'enabledPreviewProviders' =>
  array (
    'OC\\Preview\\TXT',
    'OC\\Preview\\MarkDown',
    ...
)

i.e. remove ALL the number and arrows

AiroPi commented 1 month ago

I did the first option (added the line in AdminController.php), however the preview aren't generated. I have this error in the nextcloud console:

Imaginary preview provider is enabled, but no url is configured. Please provide the url of your imaginary server to the 'preview_imaginary_url' config variable.

I guess I only needs to remove 6 => 'OC\\Preview\\Imaginary', in my config.php right?

edit: I did remove the Imaginary providers, but now I just don't have previews. No errors in the console.

AiroPi commented 1 month ago

I get No preview generator available for file of typeimage/heic when I use occ preview:generate while HEIC is enabled in Memories settings

edit: even when I enable HEIC, the list isn't updated and image/heic isn't added.

image

pulsejet commented 1 month ago

Hmmm what does the config file look like?

pulsejet commented 1 month ago

I removed the comment to get rid of any secrets, but that looks fine. What does the admin panel say about imagick?

AiroPi commented 1 month ago

PHP-Imagick is available [ImageMagick 7.1.1-26 Q16-HDRI x86_64 21914 https://imagemagick.org].

pulsejet commented 1 month ago

Okay, taking a look. The only thing that pops up is the case if this imagick isn't supporting HEIC (strange)

AiroPi commented 1 month ago

I ran magick -list format and HEIC isn't present. I don't know if this is specific to the nextcloud container from AIO or not

edit: I was just searching for imagick heic support and nextcloud heic preview generation, and I found this : https://hackerone.com/reports/1261413 Was you aware of this issue? Is it still relevant ?

pulsejet commented 1 month ago

You're right, the included Imagick doesn't have HEIC support. I've opened a PR at https://github.com/nextcloud/all-in-one/pull/4513 for adding support by default.

I believe you can set the NEXTCLOUD_ADDITIONAL_APKS to your container (though I haven't tried it). Probably something like this.

NEXTCLOUD_ADDITIONAL_APKS="imagemagick imagemagick-svg imagemagick-heic imagemagick-tiff"

and then restart (maybe).

AiroPi commented 1 month ago

Great news, it's working. HEIF are generated (and correctly oriented as well). However, Imaginary is still useful to generate other file formats such as PDF or illustrator files. Is there a way to use the Imagick HEIC preview generation in priority ? (Because when I enable Imaginary, it is used for HEIC previews) Otherwise, I don't think it is really an issue, I prefer to do without PDF previews.

pulsejet commented 1 month ago

However, Imaginary is still useful to generate other file formats such as PDF or illustrator files. Is there a way to use the Imagick HEIC preview generation in priority ?

Doesn't seem so. Imaginary always takes priority.