Use image count in other areas of website

tke852

Joined: 2003-10-19
Posts: 1
Posted: Thu, 2004-03-25 22:26

I would like to know if there is a fairly easy way to put a current photo count for all albums to appear on a different section of the website. On the home page of my site I have an area that Show when certain areas of the site were updated last. I have been asked to try and put similar function based on the gallery activity. I guess it would ideally include the total number of images in the gallery as well as the last time an album was updated. I would prefer for it to display the number of all the images as if they were logged in rather than the number that an unlogged in person will see.

Any help would be appreciated.

----
Give us your Gallery/webserver information to get a faster answer.
Get this information from the PHP diagnostic (in the configuration wizard).
Gallery URL (optional but very useful):
Gallery version: 1.4
Apache version: 1.3.27 (Unix)
PHP version (don't just say PHP 4, please): 4.3.2
Graphics Toolkit:
Operating system:
Web browser/version (if applicable):

 
Gaile

Joined: 2002-07-20
Posts: 1301
Posted: Fri, 2004-03-26 17:37

...moving to Customizing Gallery.

(more appropriate for this question, and you'll get more assistance)

Gaile

 
briandebaser

Joined: 2004-03-04
Posts: 9
Posted: Mon, 2004-03-29 19:06

I've been looking for a way to do this as well, and have posted several times before to no avail.

In my case, I'm hoping to incorporate the photo counts into tooltips on an image-map used the navigate the gallery. This is undoubtedly more complex, but if someone could help tke852 to do what he wants to do, I could figure it out from there.

My gallery:
http://www.bigflamingpile.com/winnipeg (click the GALLERY link)

Thanks.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Mon, 2004-03-29 21:46

tke852, In order to get "last time an album was updated" there is a few mods out there that would be better suited:
http://gallery.menalto.com/index.php?name=PNphpBB2&file=viewtopic&p=15271#15271
Logged in and not loged in is more complex.
But for just the counts of single albums like briandebaser, wants try:

<?php
//
// album_count.php call like: album_count.php?name=album03
// or do an include like: include("http://example.com/gallery/album_count.php?name=album03");
//
// Hack prevention.
if (!empty($HTTP_GET_VARS["GALLERY_BASEDIR"]) ||
		!empty($HTTP_POST_VARS["GALLERY_BASEDIR"]) ||
		!empty($HTTP_COOKIE_VARS["GALLERY_BASEDIR"])) {
	print _("Security violation") ."\n";
	exit;
}
 if (!isset($GALLERY_BASEDIR)) {
    $GALLERY_BASEDIR = '';
}
require($GALLERY_BASEDIR . 'init.php'); 
$tmpAlbumName = $name;
$imageTotals = getAlbumSubTotals($gallery);
// the next line will return the proper names after the count
// echo sprintf(_(" contains %s." ), pluralize_n($imageTotals[$tmpAlbumName], _("1 image"), _("images"), _("no images")));
echo $imageTotals[$tmpAlbumName]; //give the number only
?>

Save this as album_count.php in your gallery directory and then you can call it with an include like:<? include("http://example.com/gallery/album_count.php?name=album03"); ?>
I hope this points you in the direction you want to go.

Dave

 
briandebaser

Joined: 2004-03-04
Posts: 9
Posted: Mon, 2004-04-19 03:53

Better late then never?

Thanks floridave for your assistance! Much appreciated.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Mon, 2004-04-19 04:16

briandebaser,
How did it work out? Is your image map mouseovers dynamic?

Dave

 
briandebaser

Joined: 2004-03-04
Posts: 9
Posted: Mon, 2004-04-19 05:09

They are, it works perfectly.

 
cosfrog

Joined: 2006-10-13
Posts: 2
Posted: Fri, 2008-01-25 21:12

Anyone have an update for this in Gallery2?