Menu

#2921 Error creation thumbnail for png image (zlib problem?)

v4.3.1
closed-fixed
media (2)
3
2022-02-13
2017-11-13
No

hello,

I have installed SVN 7181. I receive an error during the creation of a Multimedia object (png image)
"ERROR 2: imagepng(): gd-png: fatal libpng error: bad parameters to zlib
0 Error occurred on in function imagepng
1 called from line 1993 of file functions_mediadb.php in function generate_thumbnail
2 called from line 238 of file addmedia.php

Warning: imagepng(): gd-png: fatal libpng error: bad parameters to zlib in /srv/www/htdocs/gedview/includes/functions/functions_mediadb.php on line 1993

ERROR 2: imagepng(): gd-png error: setjmp returns error condition
0 Error occurred on in function imagepng
1 called from line 1993 of file functions_mediadb.php in function generate_thumbnail
2 called from line 238 of file addmedia.php

Warning: imagepng(): gd-png error: setjmp returns error condition in /srv/www/htdocs/gedview/includes/functions/functions_mediadb.php on line 1993
Une image vignette a été créée automatiquement.
Mise à jour réussie"

Status After commit:
Record exists in table media
image exist in library media
thumbnail is bad only 54 bytes in place of ± 5-10K

content of table media
| 2879 | M2764 | | media/RP_Monet_Jeanne_N1705.png | media/RP_Monet_Jeanne_N1705.png | 1 | 0 @M2764@ OBJE
1 FILE media/RP_Monet_Jeanne_N1705.png
2 FORM png
3 TYPE fiche
1 _PRIM N
1 _THUM N
1 CHAN
2 DATE 13 NOV 2017
3 TIME 19:24:06
2 _PGVU pce23 |

OS is opensuse tumbleweed,
PHP php7-7.1.11-1.1.x86_64
php7-zlib-7.1.11-1.1.x86_64
DB = mariadb-10.1.25-3.2.x86_64

many thanks in advance
Philippe Condé

1 Attachments

Discussion

  • Gerry Kroll

    Gerry Kroll - 2017-11-14

    This appears to be a bug in PHP . Here's a link to the PHP bug report:
    https://bugs.php.net/bug.php?id=70276&edit=1

    If you can e-mail me a copy of the PNG image you're having trouble with, I can try the upload on my system. e-mail: gkroll (at) keldine (dot) ca

    In the meantime, if you want to do the upload, you can avoid the problem by supplying a thumbnail in addition to the main (full-size) image. You have to enter the main image and the thumbnail image's file names in the same upload operation. The file names are, of course different. PGV will use the main image's file name as the resulting thumbnail file name.

    You can create the thumbnail yourself by using an image editor such as IrfanView. When you create the thumbnail by adjusting the image size, specify only ONE of the two dimensions. That way, the original aspect ratio will be preserved. I suggest that you use 150 px for the larger of the two dimensions when you create the thumbnail.

    When you supply your own thumbnail image, PhpGedView does absolutely NO checks. The "thumbnail" could even be larger than the main image, and it does not need to resemble the main image at all. The results of this "no check" logic can be quite surprising. In fact, the thumbnail does not even need to be of the same type (jpg vs. BMP , for example)

     
  • Philippe Condé

    Philippe Condé - 2017-11-14

    Hello,

    In /srv/www/htdocs/gedview/includes/functions/functions_mediadb.php on line 1993 I replaced the Quality parameter (original =90) by 9 and the error doesn't more occur.

    In the PHP7 manuel it is said that the quality can only have the value 1 to 9 for function imagepng(imagefila, quality)

    So I think that this was the problem.
    Probably that the new version of php 7 is more strict about this value

    Regards
    Philippe Condé

     
  • Gerry Kroll

    Gerry Kroll - 2017-11-14
    • status: open --> open-fixed
    • assigned_to: Gerry Kroll
    • Attachments has changed:

    Diff:

    --- old
    +++ new
    @@ -0,0 +1 @@
    +SVN-7182 fix.zip (22.0 kB; application/x-zip-compressed)
    
    • Group: v4.3.0 --> v4.3.1
     
  • Gerry Kroll

    Gerry Kroll - 2017-11-14

    Thank you! Your correction, with a minor change to accommodate the difference between the imagepng() and imagejpeg() functions, has been uploaded to SVN 7182. The updated file is attached here.

    It's strange that these two very similar functions specify different ranges for the image quality parameter.

    This bug report will be closed when PhpGedVIew version 4.3.1 is released.

     
  • Gerry Kroll

    Gerry Kroll - 2022-02-13
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.