Before asking for help please read "How to request help" by clicking on that tab above here.
  • Page:
  • 1

TOPIC:

Troubleshooting thumbnails for high res images 2 weeks 1 day ago #1

  • nwagers
  • nwagers's Avatar Topic Author
  • Away
  • New
  • New
  • Posts: 22
I'm trying to track down why exactly webtrees won't generate thumbnails for a large image. I uploaded a 4835 x 6335 pixel jpg that is 6.46 MB. This one wouldn't create thumbnails. I resized it to 2550 x 3341 and it began creating thumbnails for it.

Webtrees server infomartion says I have both gd and imagick installed. I assume webtrees will use imagick by default when both are available. imagick is version 3.4.4 (Nov 2017) and the formats include JPG JPEG and PNG.

I loaded up my php settings from my hosting provider (GoDaddy deluxe linux hosting via cPanel). The "memory_limit" is set at 368M and "max_execution_time" is set to 240 for testing. The page finishes loading way before 4 minutes. Physical memory is 512 MB and it was generating thumbnails for 2550 x 3400 images with 128 MB memory limit.

My apache server logs show a 503 error when trying to GET the thumbnail. Nothing shows up in the Webtrees logs related to creating the media object, uploading it, or failure to generate thumbnails. I'm not sure if there should be some sort of PHP error log, but if there is, I couldn't find one anywhere. PHP "error_reporting" is set to E_ALL.

You can see the media objects and the working an non-working jpgs here: nwagers.com/tree/Wagers/media/X80/Misc-S...-Sibiling-Obituaries

Please Log in or Create an account to join the conversation.

Troubleshooting thumbnails for high res images 2 weeks 2 hours ago #2

  • nwagers
  • nwagers's Avatar Topic Author
  • Away
  • New
  • New
  • Posts: 22
Partially solved:

I'm unable to find an error log that details the exact problem, but I believe I've mostly figured it out. I checked a few random times and my httpd process was using just over 200 MB of RAM. That leaves about 300 MB left for image processing (hosting limit of 512 MB).

My imagick version (which I can't change) has a pixel quantum level of 16, or Q16. When loading an image it uses 5 * Q / 8 per pixel, or in my case 10 bytes. That turns a 30 megapixel image to 300 MB and exceeds my physical memory limit.

From some searching, gd is using 4 bytes per pixel and is safely under my max. I simply disabled the imagick module in my php settings and now it generates the thumbnails.

Webtrees could possibly have an automatic retry with gd if imagick fails because it doesn't have enough memory, or add in a pixel limit to switch over to gd. It could also generate thumbs from the highest res thumb available instead of the original image. It probably sacrifices some tiny amount of quality, but it may have speed gains for big images.

Hopefully this helps someone in the future.

Please Log in or Create an account to join the conversation.

Troubleshooting thumbnails for high res images 1 week 6 days ago #3

  • fisharebest
  • fisharebest's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 13196
Thanks. I knew GD uses 4 bytes/pixel - and just assumed Imagick would be the same.

I'll update the FAQ.

Looking at the Imagick documentation, it seems we can tell it to limit the amount of memory it uses.
(Above this limit, it will use a temp file on disk).

However, we don't use Imagick directly - we use it via library ( glide.thephpleague.com/ ),
and so it is hard to modify this behaviour.

The glide library has been effectively abandoned for a couple of years. I guess I need to find a replacement or write my own...
Greg Roach - This email address is being protected from spambots. You need JavaScript enabled to view it. - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

Last edit: by fisharebest.
  • Page:
  • 1
Powered by Kunena Forum