NextGEN Gallery v2 Resize Issue Persists

If you are concerned about the quality of your NextGEN Gallery v2.x resized images, this should be of particular interest to you.

Some months ago I contacted Photocrati to ask them how, in version 2.x, developers could retrieve the “actual” dimensions of a resized image. In the past, after resizing an image we could use PHP’s getimagesize() function on the resulting file, but in v2.x image resizing is dynamic and those resized images may not be available on disk. I had some concerns between the expected / calculated image dimensions, those returned by NGG v2.x’s methods / functions, and the actual image retrieved by the URL. All 3 dimensions were different! A resized uncropped image which should have been 300x200px, was reported as being 300x199px by the NGG methods / functions, and the image retrieved by URL was 298x199px!

This may not sound like much, but a few pixels here and there can lead to image distortion when rendered by browsers, alignment issues in page layouts, and failures when working with minimum image dimensions (for example, Facebook ignores images smaller than 200x200px).

Although Photocrati’s first-line support was helpful, this matter required the attention of Photocrati’s DEV team, which were not responsive. After waiting several weeks for the matter to be escalated, I paid for Pro support and re-submitted my question / issues again. Photocrati’s first-line support where responsive, but could not get the DEV team to look at this. After the holidays I asked them to escalate or refund my Pro support. The matter was finally escalated and I was forwarded some code to generate images and get information on the result. Unfortunately, this code was very similar to the code I’d already submitted as an example, so no help at all.

I’m pretty sure Photocrati’s DEV team is swamped by v2.x bugs — we all remember the massive failure of v2.x’s release — so I don’t blame them for wanting to turn a blind eye to another bug, but they should have at least recognized the seriousness of the issue. I explained the problem several times — some of their first-line support understood the problem, and some did not (or would not) understand.

Considering my experience with this, I don’t expect the issue to be resolved any time soon, so I’ll document the problem here for other NextGEN Gallery v2.x users (feel free to borrow any of this text for your bug reports). The problem should be apparent for any uncropped image where the resized number of pixels is not a perfect integer. For example, an image of 2048x1365px downsized to 300x300px is 300×199.951174px (300x200px rounded). I expect there’s a bug in NGG v2.x’s rounding, so the size comes out to 300x199px instead. Those dimensions must then be used to scale the image, which creates a final image of 298x199px. Why they would choose to do it this way is a mystery to me — it seems the image should be resized first, then it’s dimensions reported, not the other way around (there’s a reason the horse goes before the cart).

Here’s some example code to re-create the issue:

2 thoughts on “NextGEN Gallery v2 Resize Issue Persists

  1. Just wanted to thank you very much for taking the time to post this. I am having problems with my NextGen Pro Album Grid display. Some images are landscape and some portrait and one compared to the other seems to be out by (approx.) 1px. So a row of landscapes will match up but if there is a portrait image in there then then the box will be slightly askew. It doesn’t seem like much but it catches the eye and looks unprofessional.

    I will log it with the Photocrati Pro support but guessing im not going to get much resolution.

    Thanks again for this info.

    • This post is probably a little dry and code-heavy, so I wasn’t sure it would be helpful to anyone. ;-) I’m glad to hear that it helped solve your alignment issue — it’s why I wrote it. :)

      I used to be a fan of NGG — it’s why I wrote the NGFB Open Graph+ plugin — but after the disaster of v2.0, and the continued lack of support and code documentation from Photocrati, I no longer suggest NGG to my friends and clients.


Comments are closed.