Forum

Thread tagged as: Problem, Addons

How to display total images in a gallery album

We recently upgraded to 2.7.3 from an earlier version of 2.

The code we are using on our Album page to show image number and total is no longer working as expected. The total number of images in the gallery is no longer accurate. This is pulling in from js script.


<p id="image_counter"><span id="current_image">-</span> of <span id="total_images">-</span></p>

For example, in one album there are 88 images, as seen in CMS and I checked DB, but front end says 56? Any idea why this would be happening just from changing core? We only have 4 albums.... and filtering is on front end, but this figure above is for "view all".

Is there a built in way to show total images in an album/gallery?

Also, perhaps related, the page title just for album pages seems to have disappeared... ? Even though it's populated in the CMS backend under "Page Details". Front end shows:


<!-- Undefined content: SEO-Website-Title -->

Should I perhaps re-upload the CORE folder again??

Thanks.

Stuart Farrell

Stuart Farrell 0 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

How are you calculating those numbers?

OK, the actual images in one gallery is 102 (counting thumbs in CMS), but CMS and DB say 88 in listing page for albums in GALLERIES.

The front end says 56 (but I think this is "featured" images only, a filter we apply) so disregarding the front end JS error, there is something not right about the numbers in DB and backend galleries...

Is there a quick way to rebuild DB? Or, should I manually change "imageCount" column in "gallery_albums" table in DB?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Are you sure some of those are duff uploads?

Not sure what you mean...

I can see the thumbs and view details of images uploaded to albums BUT the number in the gallery list pages of images in each albums does not match the actual number of images inside the albums. I have checked a whole bunch and they are not dud uploads.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok. Where are you getting the counts from?

A manual count of thumbs in CMS of the gallery made me check DB.... DB table of imageCount did NOT match a query for the album ID I ran. The query in DB shows the thumbnail list is correct but imageCount is not. So should I just change manually in DB?

SELECT * FROM `perch2_gallery_images` WHERE `albumID` = 3

Result = 102.... Total in CMS (imageCount) was 88???

Have just noticed one small thing....

When we updated CMS and upload new images, this figure of imageCount (EG: 88) did not update and I noticed that imageSlug changed slightly? A zero was added....

Last image uploaded in old version: imageSlug: people88 First image uploaded in the new version: imageSlug: people089

???

Drew McLellan

Drew McLellan 2638 points
Perch Support

You need to add

SELECT * FROM `perch2_gallery_images` WHERE albumID=3 AND imageStatus='active'

OK yeah, see your point but they are all active. Ran again with active status check and still get 102...

We have fixed the front end display of total images per gallery... I guess we can just manually change image count for CMS.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok. I don't fully understand what's happening there.

In summary, what's happened is that after an upgrade to a newer version of Perch, the "imageCount" for the Gallery albums is no longer correct.

It seems that in newer versions it adds a zero in front of number and no longer adds images uploaded later on to the total. We will manually reset in DB then see if it changes when newer images are uploaded.

Drew McLellan

Drew McLellan 2638 points
Perch Support

I'll see what I can find from this end.