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

500 error generating preview with imagick/gd #1009

Closed
ss-smk opened this issue Mar 10, 2023 · 8 comments
Closed

500 error generating preview with imagick/gd #1009

ss-smk opened this issue Mar 10, 2023 · 8 comments

Comments

@ss-smk
Copy link

ss-smk commented Mar 10, 2023

Describe the bug
When using the gd or imagick extensions in php , the preview for jpg files is not shown, and a 500 error is displayed in the broser console. At the same time, nothing is written to the log about the cause of the error. Same appears with clear gd, without imagick/gmagick at all.
Preview appears only with gmagick extension enbled.

To Reproduce
Steps to reproduce the behavior:

  1. Open message with jpg file (while gmagick not exnabled/installed, only imagick/gd)
  2. 500 error appears in console, no preview shown.

Expected behavior
The documentation says that the use of jmagick and gmagick is equivalent, and with any of them, previews should be generated.
If i see a 500 error, then imagick is not working properly.

Screenshots
snappy-err-500

Please complete the following information:

  • Browser: FF 110 (doesn't matter)
  • IMAP daemon: dovecot
  • PHP version: 8.1.16
  • SnappyMail Version: 2.26.4

Debug/logging information
No error messages found in logs.

@ss-smk ss-smk changed the title 500 error generating preview in imagick/gd 500 error generating preview with imagick/gd Mar 10, 2023
@fszontagh
Copy link

  • IMAP daemon: dovecot
  • PHP version: 7.4.33
  • SnappyMail Version: 2.26.4

Some test case:

  1. Only GD module enabled: same error
  2. Only gmagick module enabled: same error
  3. GD and gmagick enabled: same error

Error in the logs:

[2023-03-12 17:05:24.183][99547285] [NOTICE]: insufficient image data in file `/tmp/magick-tXrbEGsDE_m0HKeg1k3k0ZTE7fR87qub' @ error/jpeg.c/ReadJPEGImage_/1166

list of files in temp:

root@snappymail:/tmp# ls -ltr /tmp/magick-*
-rw------- 1 www-data www-data 892982 Mar 12 16:03 /tmp/magick-nWvbeTLd2RMm7QRXs28bQTsnT4ivM2uh
-rw------- 1 www-data www-data 892982 Mar 12 16:05 /tmp/magick-Nz5Fmaa9KP7alfRQc600dYu7aXdPxred

@fszontagh
Copy link

I figured out, it was by the wrong / missing timezone. In the OS (/etc/timezone) need to configure to the client's timezone. In the php.ini must be set too (date.timezone). After the changes, the thumbnail images will be visible (with gd, imagick and gmagick enabled too), but on click on the image's thumbnails, nothing happening. (and no js errors in the browser's console)

@ss-smk
Copy link
Author

ss-smk commented Mar 13, 2023

I figured out, it was by the wrong / missing timezone. In the OS (/etc/timezone) need to configure to the client's timezone. In the php.ini must be set too (date.timezone). After the changes, the thumbnail images will be visible (with gd, imagick and gmagick enabled too), but on click on the image's thumbnails, nothing happening. (and no js errors in the browser's console)

I set timezone in php.ini , /ets/localtime , /ets/timezone - but where still doesn't no preview with GD, neither imagick.. Only Gmagick works. (ofc i restarted php-fpm to apply)

Yes, by clicking on the preview nothing happens, but I didn’t focus on this, maybe it should work like that.

@fszontagh
Copy link

did you restarted the OS too? I use it in docker, i restarted after the changes, then worked. Some service need restart to apply the timezone changes, maybe the webserver restart is enough.

@ss-smk
Copy link
Author

ss-smk commented Mar 14, 2023

I tried to restart OS (container), but nothing changed, imagick or gd still didnt work. I suspect the problem is in the php version, or Imagick verison.
Also i compare previews in rainloop and snappymail, pdf looks different, and in old rainloop image (jpg) opens image, but snappymail - not.
Rainloop:
rainloop-old
Snappymail:
snappymail

@Niveshkrishna
Copy link

I also have this problem in nextcloud + snappymail. Here's some debug log:

[2023-03-15 10:19:11.698][5428c32f] IMAP[INFO]: Start Callback for FETCH / BINARY[2] - try to read 2216 bytes.
[2023-03-15 10:19:11.699][5428c32f] RAW[DEBUG]: Array
(
    [0] => [email protected]
    [1] => image/png
    [2] => [email protected]
    [3] => image/png
)

[2023-03-15 10:19:11.709][5428c32f] [NOTICE]: improper image header `/tmp/magick-NFE5sTzbDFIwHprEF4bj3YqH9Jlth84J' @ error/png.c/ReadPNGImage/4107

@the-djmaze Can you help us understand this issue?

@the-djmaze
Copy link
Owner

At first there was an exit; to stop PHP.
This caused issues in Nextcloud CLI and i removed them.

Now i think that Nextcloud wants to set headers after echo and fails again.

Next release has changes to prevent this, but probably reveal another Nextcloud bug.
So stay tuned until i found the Nextcloud bugs.

the-djmaze pushed a commit that referenced this issue Mar 28, 2023
@Niveshkrishna
Copy link

@the-djmaze This is working in 2.27.2. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants