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

Preview Gallery not working on some TIF and TIFF #12876

Closed
vindic opened this issue Dec 6, 2018 · 14 comments
Closed

Preview Gallery not working on some TIF and TIFF #12876

vindic opened this issue Dec 6, 2018 · 14 comments
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap needs info

Comments

@vindic
Copy link

vindic commented Dec 6, 2018

After i have migrated a previous installation of Nextcloud 14.0.2 from Ubuntu 16.04 to Ubuntu 18.04 and then NC 14.0.4 the preview for some TIF images wasn't working.


NextCloud version : 14.0.4
Operating system and version : Ubuntu 18.04
Apache : 2.4
PHP version : 7.2
ImageMagick : 6.9.7-4


I have first posted the issue in Support Section : https://help.nextcloud.com/t/nc14-problems-with-preview-tif-ai-raw-images-on-new-installation/42445

Files having issues :

  1. the TIF images containing .tiff extension

  2. The TIF images having a MimeType recognized as image/x -dcraw

I don't know if the causes of this malfunctions is the 14.0.4 NC update or the new Imagick Library installed by default on Ubuntu 18.04


The first fix was to modify the PreviewManager.php line 368

adding an image magick provider for the TIFF files =>

'TIFF' => ['mimetype' => '/image\/tif/', 'class' => Preview\TIFF::class]

The second fix was to add a provider for the mimetype 'image/x-dcraw'

$this->registerCoreProvider(Preview\TIF::class, '/image\/x-dcraw/');

I have to add it as a a registerCoreProvider because the imagickProviders is using only one extension by mimetype.

@ChristophWurst
Copy link
Member

Could you submit a PR if that is a bugfix?

@vindic
Copy link
Author

vindic commented May 6, 2019

I will not submit a PR because this is a quick and dirty fix.

I don't understand why the extension *.tiff is not working anymore, it was working before and if this bug is generic or if it's only on my server.

@skjnldsv skjnldsv added the 0. Needs triage Pending check for reproducibility or if it fits our roadmap label Jun 12, 2019
@james-cook
Copy link

james-cook commented Jun 12, 2019

I can at least confirm the error with NC15.
PDF files work when enabled as described (config.php from sample config) AND policy.xml changes for PDF for ImageMagick etc. etc.
But unclear how to get tiff to work.

 'enabledPreviewProviders' => array(
        'OC\Preview\PNG',
        :
        :
        'OC\Preview\MarkDown',
        'OC\Preview\PDF',
        'OC\Preview\TIFF',

The error in the log is:

    OCP\Files\NotFoundException: 
    /var/www/nextcloud/lib/private/Preview/Generator.php - line 118:
    OC\Preview\Generator->getMaxPreview(OC\Files\Sim ... {}, OC\Files\Node\File {}, "image/tiff")
    /var/www/nextcloud/lib/private/PreviewManager.php - line 205:
    OC\Preview\Generator->getPreview(OC\Files\Node\File {}, 2000, 2000, false, "fill", "image/tiff")
    /var/www/nextcloud/apps/gallery/lib/Service/PreviewService.php - line 106:
    OC\PreviewManager->getPreview(OC\Files\Node\File {}, 2000, 2000, false)
    /var/www/nextcloud/apps/gallery/lib/Controller/Preview.php - line 167:
    OCA\Gallery\Service\PreviewService->createPreview(OC\Files\Node\File {}, 2000, 2000, true, false)
    /var/www/nextcloud/apps/gallery/lib/Controller/Preview.php - line 117:
    OCA\Gallery\Controller\PreviewController->getPreviewData(OC\Files\Node\File {}, true, 2000, 2000, true, false)
    /var/www/nextcloud/apps/gallery/lib/Controller/PreviewController.php - line 134:
    OCA\Gallery\Controller\PreviewController->getData(203396, 2000, 2000)
    /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 166:
    OCA\Gallery\Controller\PreviewController->getPreview(203396, 2000, 2000)
    /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher

Converting the same file on the command line does work - so ImageMagick does contain a tiff to image converter...
Is some other tool to be used instead of ImageMagick.
Does something else need to be set?

@schniepp
Copy link

schniepp commented Sep 5, 2019

I also have a problem viewing TIFF files in nextcloud now (v16), when it was not a problem in earlier versions.
Problem 1: when I click on them, TIFFs are now downloaded instead of watched in the viewer.
Problem 2: no thumbnails are being created in either "file" or "grid" viewing modes.

Interestingly, the previews of TIFFs that appear to have been created by earlier nc versions are still shown. Also, if I use the (old) gallery app to view pictures, I can browse through the old folders with existing previews. From the gallery app, I can even get the TIFFs to be displayed in a window-filling manner by clicking on them. However, if I go to a newer folder with no previews, this files don't even show up in the gallery app.

In some respects I liked the old gallery app better. But currently there is quite a confusion between gallery app and the other two view modes (list/grid). I am also not sure what we call "preview" — is it the thumbnail that's displayed in grid/list modes, or is it what I get when I click on an image so that it's displayed in window size? (I am not calling it full-size, as I am not sure whether these are actually down-scaled versions of the pictures.)

In general, I find matter quite messy in this respect at present.

@vindic
Copy link
Author

vindic commented Nov 21, 2019

Just made the migration from Nc 16.01 to Nc 17.01 and the bug is still present.

The fix seems the same.

@vindic vindic changed the title Preview Gallery not working on some TIF Preview Gallery not working on some TIF and TIFF Nov 21, 2019
@d--j
Copy link
Contributor

d--j commented Nov 22, 2019

I think the root cause is that something wrongly detects the MIME type of a .TIF file as image/x-dcraw instead of image/tiff.
If I upload the same file with file extension .TIF I get the MIME type image/x-dcraw. If I change the file extension to .tiff the MIME type is the correct image/tiff.

Here is a test file: test-tiffs.zip

@kesselb
Copy link
Contributor

kesselb commented Dec 27, 2019

Hey. I'm not sure how to reproduce this issue. Do you still see this issue?

  1. I've uploaded the test files provided by @d--j to my nextcloud (18) instance. The mime type was correct for both files. Nextcloud contains the mapping by default (since 2015) that will assign image/tiff to files with .tif or .tiff extension.

"tiff": ["image/tiff"],
"tif": ["image/tiff"],

  1. By default previews are not enabled for image/tiff. To enable previews add 'OC\Preview\TIFF' to enabledPreviewProviders in config.php (imagick extension for php is enabled on my system).
  2. I see previews for both files.
    image

Opening the files with viewer (default app for viewing files since Nextcloud 17) do not work. Files are downloaded. This seems to work for a png file. A enhancement issue is already filled over here: nextcloud/viewer#229

If this is still a issue for you please provide a detailed way how to reproduce this problem. Adding the issue template would help a lot.

@d--j
Copy link
Contributor

d--j commented Jan 2, 2020

Hi @kesselb

while compiling the data for the issue template I stumbled upon the active app Camera RAW Previews. Deactivating this app fixes TIF-previews for me.

I have opened an issue there: ariselseng/camerarawpreviews#39

For me at least TIF preview is working as it should now (of course after adding OC\Preview\TIFF as a preview provider. @schniepp @vindic @james-cook do you also have the app camerarawpreviews active? Does deactivating it helps?

We have a little app that registers TIFF files handling for the viewer app (via the nextcloud previews). Somehow that is necessary despite nextcloud/viewer#33 being merged.

@schniepp
Copy link

schniepp commented Jan 4, 2020

@d--j: Yes, I had Camera RAW Previews installed, and disabling it changes the behavior.

@mbc0
Copy link

mbc0 commented Jan 11, 2020

Hi,

I have a fresh install and have the problem where thumbnails for tiff's are not being displayed (jpeg's are fine) I do not have any apps installed, can anyone please point a "noob" in the right direction to get this working, even if it is a dirty fix?

Many Thanks in advance!

@d--j
Copy link
Contributor

d--j commented Jan 11, 2020

@kesselb I think you can close this issue.

@mbc0 Just install the Camera RAW Previews App – in its newest version it will give you TIFF thumbnails without any configuration changes (only if your server has the Imagick PHP extension installed).

If your server does not have PHP's Imagick extension installed you are out of luck.

Anyways, you should probably move your question over to https://help.nextcloud.com/ – this here is the wrong place to ask questions.

@kesselb
Copy link
Contributor

kesselb commented Jan 11, 2020

Thanks @d--j 👍

@kesselb kesselb closed this as completed Jan 11, 2020
@james-cook
Copy link

james-cook commented Jan 11, 2020

My problem still exists - but I think it could be a wider issue with MY system - some kind of clash between gd and imagemagick.

I am getting strange errors even trying to debug the issue in ./lib/private/Preview/Bitmap.php
In particular errors like:

php ImagickException:
JPEG parameter struct mismatch: library thinks size is 520, caller expects 512

(I know in general we are trying to convert TIFF to PNG...)

And in other tests - memory allocation errors...

As the original system is full of legacy websites that are all very fragile I've decided to move my testing of this issue to a new droplet and using docker for more effective control of the testing environment.

Currently using https://github.com/ReinerNippes/nextcloud_on_docker on a 16.04 ubuntu droplet. Nextcloud version 17.02.
So far TIFFs are still not converted... but I'm just starting to test.

I'll comment here if I find anything relevant.

@james-cook
Copy link

james-cook commented Feb 6, 2020

My current impression is that my problems are a "special case" due to how I compiled pdlib/dlib into the system (to use the facerecognition app). Changing the compile parameters solved the problem.

See my investigation at: matiasdelellis/facerecognition#216

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 needs info
Projects
None yet
Development

No branches or pull requests

8 participants