Latest Images / Most Viewed Hack

Raven69
Raven69's picture

Joined: 2004-01-16
Posts: 24
Posted: Mon, 2004-04-26 06:17

hi Jeremy,

another suggestion for your incredible script:

what about using a 'stats_config.php' to setup all the initial values for:
...
$photosPerPage = 10;
$totalPhotosToDisplay = -1;
$showCaptureDate = 0;
...

so that one has not to change them every time you release a new version for your hack.

Regards, Raven

 
myriagon

Joined: 2004-01-22
Posts: 130
Posted: Mon, 2004-04-26 08:34

Raven69 - yes I've been thinking about that one myself. The only problem is that I keep adding new variables which need to go in the config section. Ideally I need a method to add new variables to 'stats_config.php' without changing any of the current settings and to make it as easy as possible to prevent errors. I guess this would do it:

cat newvars.php >> stats_config.php

However if someone skipped from version 1.60 to 1.94, then they would need to apply all the newvars.php files for version 1.61, 1.62, 1.70 etc to get uptodate - not pretty.... Anyone know a better way that isn't too complex and wouldn't need the installer to do anything?

Regards,

Jeremy

www.tearoom.me.uk

 
Raven69
Raven69's picture

Joined: 2004-01-16
Posts: 24
Posted: Mon, 2004-04-26 08:47

a useful way could be to set the variables in stats.php und after the last var. include stats_config.php which will override the settings in stats.php.
so all own variables will stay the same after updating and the new ones will be read from stats.php.

or to include include to config files:

stats_config.default.php (with default and new settings)
stats_config.php (with the own settings which will override the default)

hope this helps

Raven

 
Raven69
Raven69's picture

Joined: 2004-01-16
Posts: 24
Posted: Mon, 2004-04-26 08:53

a useful way could be to set the variables in stats.php und after the last var. include stats_config.php which will override the settings in stats.php.
so all own variables will stay the same after updating and the new ones will be read from stats.php.

or to include include to config files:

stats_config.default.php (with default and new settings)
stats_config.php (with the own settings which will override the default)

hope this helps

Raven

 
myriagon

Joined: 2004-01-22
Posts: 130
Posted: Mon, 2004-04-26 08:56

Thanks Raven :)

I should have thought of that myself after seeing how the headers and footers work in Gallery. Next time I do a release I will add a default config file which can be overridden by your own config file.

Regards,

Jeremy

 
nicho

Joined: 2003-04-24
Posts: 26
Posted: Wed, 2004-04-28 17:04

I really glad I found this hack. It's awesom.

I'm using the gallery to show lots of pics of differents sports and categories. Like:

--Gallery
---Football (Sport / parent album)
----Girls (Sub-album)
------Event1 (nested album)
-----------pics
------Event2 (nested album)
-----------pics
----Men (Sub-album / parent album)
----Girls (Sub-album)
------Event1(nested album)
-----------pics
---Basketball
...and so on....

Actually the hack display the name of the Event (nested album) but I would like to have the name of the Sport (sub-album). Is there a why to get that easily ?

 
mcgrelio
mcgrelio's picture

Joined: 2003-02-03
Posts: 52
Posted: Fri, 2004-04-30 00:24

Hi myriagon, first let me say i really love your hack and your photo's too!
I've downloaded you stats file today so i think it's the 1.93 version and uploaded in my gallery 1.4.3final home www.mcgrelio.com/bin/gallery.
When i point to the stats file in the browser ( http://www.mcgrelio.com/bin/gallery/stats.php?type=views ) my server responds with:

Fatal error: Allowed memory size of 8388608 bytes exhausted at (null):0 (tried to allocate 65537 bytes) in /var/www/html/bin/gallery/util.php on line 338

Probably you've already answered to this issue but i can't find the right post for me so plz excuse me :)
Should i ask to my ISP admin for more memory or is it a script issue?
Thx a lot, i hope i can solv my problems soon because your hack rulez!

 
DarkunderdoG

Joined: 2003-08-16
Posts: 58
Posted: Fri, 2004-04-30 02:46

Mcgrelio,
See if your ISP can up the Memory_Limit in PHP for you.

 
DarkunderdoG

Joined: 2003-08-16
Posts: 58
Posted: Fri, 2004-04-30 03:14

actually i think i found something that fixed the same problem i was having with a different application..

Add the following to your .htaccess file in the root of you gallery directory.

<FilesMatch "\.(php|html?)$">
php_value memory_limit 20000000
</FilesMatch>

Then give Stats a Try!

 
mcgrelio
mcgrelio's picture

Joined: 2003-02-03
Posts: 52
Posted: Fri, 2004-04-30 07:58
DarkunderdoG wrote:
Add the following to your .htaccess file in the root of you gallery directory.

<FilesMatch "\.(php|html?)$">
php_value memory_limit 20000000
</FilesMatch>

Thx for your answer!
Nope :oops: It didn't solve my problem :(
I've contacted my ISP for the memory limit. Arghhhhhhhhhh!
I DO WANT THIS SCRIPT!!!! :lol:

 
myriagon

Joined: 2004-01-22
Posts: 130
Posted: Fri, 2004-04-30 11:10

mcgrelio - try using ini_set as described here

Regards,

Jeremy

www.tearoom.me.uk

 
mcgrelio
mcgrelio's picture

Joined: 2003-02-03
Posts: 52
Posted: Fri, 2004-04-30 16:00
myriagon wrote:
mcgrelio - try using ini_set as described here

Ok ok ok, you ARE a semi-God :D
IT WORKS!!
I've added the code here:

/ End of Control Variables
// --------------------------------

// Make vars passed in from the url available to the script
// This is necessary when the php var register_globals is OFF.
if (ini_set("memory_limit", "100M"))
    echo "Set memory limit<br>";
else
    echo "couldn't set memory limit<br>";

echo "memory_limit set to = ".ini_get("memory_limit")."<br>";

if (!ini_get("register_globals"))
{
   foreach ($_REQUEST as $k=>$v)
   {
      if (!isset($GLOBALS[$k]))
      {
          ${$k}=$v;
      }
   }
}

Just said "semi" because the php sends strange alerts ;)

Set memory limit
memory_limit set to = 100M

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /var/www/html/bin/gallery/stats.php:107) in /var/www/html/bin/gallery/session.php on line 60

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/bin/gallery/stats.php:107) in /var/www/html/bin/gallery/lib/lang.php on line 319

Of course you can see it in action here:
http://mcgrelio.com/bin/gallery/stats.php?type=views

Any idea?

 
mcgrelio
mcgrelio's picture

Joined: 2003-02-03
Posts: 52
Posted: Fri, 2004-04-30 16:17
mcgrelio wrote:
Just said "semi" because the php sends strange alerts ;)

Don't consider me ;)
I fix that problem commenting some echo lines.
After watching that the hack works fine i've substituted your lines with these ones:

// End of Control Variables
// --------------------------------

// Make vars passed in from the url available to the script
// This is necessary when the php var register_globals is OFF.
if (ini_set("memory_limit", "100M"));
// echo  "Set memory limit<br>";
else
   echo "Set memory limit<br>couldn't set memory limit<br>";

// "memory_limit set to = ".ini_get("memory_limit")."<br>";

and everything is good.
The script is great, YOU TOO!!!

PS. OT.
I DO love the "Swans at dusk" pic!!

 
mcgrelio
mcgrelio's picture

Joined: 2003-02-03
Posts: 52
Posted: Mon, 2004-05-03 23:45

Is it possible to call stats.php?type=views specifying the number of photos to be displayed (to make a top 10)?
Yes, i can create a top 10 pointyng to an altered copy of stats.php with $totalPhotosToDisplay set to the right value but it'd be better if I have 1 stats.php changing dinamically.
Thx a lot!

 
myriagon

Joined: 2004-01-22
Posts: 130
Posted: Mon, 2004-05-03 23:55

Try stats.php?type=views&total=10 Checkout the readme for all url vars that can be set.

Regards,

Jeremy

www.tearoom.me.uk

 
Neone

Joined: 2003-12-28
Posts: 54
Posted: Tue, 2004-05-04 08:18

What if I want the link to be opened in a new window?
When I click the TEXT link, the link to the album, then it opens in a new window.
I've manged to fix that. But I want a new window when you click on the thumbs as well.

I've added target=\"blank\"
into every a href tag there is in the stats.php. Except for those tags that takes you to page 1,2,3,4.

I'm using the script/hack to view the top 30 most viewed, 30 randomed and 30 latest pics to create a more "living" site. And it fooks up my design if the links is being opened within the same frame/window (since I have to use another background then the one that my gallery use to smooth out the design). So I need the to be opened in a 600x600px new window.

Where do I manipulate the code to get that result?

Take a look at http://www.uvpucko.com to view my site.
The script/hack is located at: http://www.uvpucko.com/gallery/stats.php?type=views

Click a thumbnail, and you'll get me when I say that it fooks up my design :)

 
mcgrelio
mcgrelio's picture

Joined: 2003-02-03
Posts: 52
Posted: Tue, 2004-05-04 22:16

I've wrote a mini-tutorial for inserting a [View comments] link next to each album (sub-album) letting to watch that album comments (according to the album permissions). The MOD also add a counter showing the total count of comments for the album and nested albums.
This MOD use the stats.php MOD so i post here the link hoping it can helps some newbie like me.
You can find it HERE.

 
Neone

Joined: 2003-12-28
Posts: 54
Posted: Tue, 2004-05-04 23:31

It sounds nice. Maybe I can enable commenting just from the stats.php page?

I've managed that the "Viewed: xxx times" only appears on the stats.php page, but nowhere else in the gallery :D

Maybe I can enable commenting from only the stats.php page as well? :)

Does anyone know how I can solve my _blank issue? :)

 
HMetal

Joined: 2003-11-09
Posts: 16
Posted: Wed, 2004-05-05 06:17
myriagon wrote:
There's a new version of stats (1.94) - second today...!

Hi Jeremy,

I'm running Gallery 1.4.3.

I just downloaded and installed stats 1.94 and when I run it (stats.php?type=views or even stats.php without arguments), I get the following error:

PHP Fatal error: Call to a member function on a non-object in /usr/home/htdoc/modules/Gallery/classes/AlbumItem.php on line 58

Line 58 contains:

$dir = $gallery->album->getAlbumDir();

I did a bit of debugging (as much as I could within reason) and it is occuring somewhere in the big loop of stats.php that starts at:

for ($i = 0; $i<$numAlbums; $i++)

Any idea what would be causing this error?

 
HMetal

Joined: 2003-11-09
Posts: 16
Posted: Wed, 2004-05-05 06:36

Update:

I found that if I supply an album name, the error goes away.

Does stats.php not start at the top-level and get all accessible albums if no album is specified?

 
myriagon

Joined: 2004-01-22
Posts: 130
Posted: Wed, 2004-05-05 06:56

HMetal - it looks like you have some old photos in your gallery that have no upload date. What's happening is that stats is querying the upload date using the Gallery api, getUploadDate(). This api finds there's no upload date so it attempts to set one. Unfortunately the Gallery code that sets the upload date relies on a global variable $gallery->album - not good. Try making the following change to stats.php as a workaround:

      $numPhotos = $statsAlbum->numPhotos(1);
      for ($j = 1; $j <= $numPhotos; $j++)
      {
         if ( !isAlbum($statsAlbum, $j) &&
              (!$statsAlbum->isHidden($j) || $gallery->user->isAdmin()))
         {
            ++$totalNumGalleryPhotos;
            $uploaddate = $statsAlbum->getUploadDate($j);

to:

      $numPhotos = $statsAlbum->numPhotos(1);
      $gallery->album = $statsAlbum;
      for ($j = 1; $j <= $numPhotos; $j++)
      {
         if ( !isAlbum($statsAlbum, $j) &&
              (!$statsAlbum->isHidden($j) || $gallery->user->isAdmin()))
         {
            ++$totalNumGalleryPhotos;
            $uploaddate = $statsAlbum->getUploadDate($j);

Let me know if that works. You should only need to run stats.php once with that code. It should set all the upload dates so you could then revert back to the original code. I'm not sure about adding this permanently to stats as I prefer to avoid Gallery globals that I don't fully understand although I suspect this particular change will be fine.

Regards,

Jeremy

 
myriagon

Joined: 2004-01-22
Posts: 130
Posted: Wed, 2004-05-05 07:01

HMetal - just read your latest post. My guess there is that you have specified an album that contains no old photos so the problem appears to go away. Either that or something else has run that had the global set and therefore the upload dates have now been set - at least for that one album.

Regards,

Jeremy

 
HMetal

Joined: 2003-11-09
Posts: 16
Posted: Wed, 2004-05-05 07:14
myriagon wrote:
My guess there is that you have specified an album that contains no old photos so the problem appears to go away.

Jeremy,

It appears that there was a corrupt album on my system.

Knowing that stats.php worked if I specified an album name, I started at the top level and worked down, running stats.php with each album as argument until I found a suspect.

When I found the one that broke stats.php, I then selected rebuild thumbnails and reorder album for that album and waited for the processes to complete.

After doing so, I can now leave out the album name and stats.php works great without an album specified.

Problem solved but now we at least know how to fix the problem if it happens for someone else. :)

P.S. Sorry, I did this before trying your workaround code. If it happens in future, I'll try the code to see if it fixes the problem then.

 
myriagon

Joined: 2004-01-22
Posts: 130
Posted: Wed, 2004-05-05 11:05

HMetal - I'm glad you didn't need my fix.

What you did is much better than changing code. :)

Regards,

Jeremy

www.tearoom.me.uk

 
rbrown3rd

Joined: 2003-04-23
Posts: 100
Posted: Thu, 2004-05-06 11:28

I just upgraded to the latest version of Gallery. I have been using your great hacks to show most viewed and latest images for a long time and really like them. However, now the link produces only the following:

Fatal error: Call to undefined function: isalbumname() in /usr/www/users/bofus/bbbrown/gallery/stats.php on line 165

Is there an upgrade for your hacks? Has the upgrade to Gallery broken them? You can see my links at http://www.bbbrown.com/ where you can see "Latest Photos" and "Popular Photos" on the left.

Bob

 
myriagon

Joined: 2004-01-22
Posts: 130
Posted: Thu, 2004-05-06 11:35

Bob - the latest Gallery code broke stats. There's an update here that should work with both the latest Gallery and earlier versions too.

Regards,

Jeremy

www.tearoom.me.uk

 
rbrown3rd

Joined: 2003-04-23
Posts: 100
Posted: Thu, 2004-05-06 13:48

Thanks very much Jeremy. That fixed it. The only problem is when I run my Latest Photos link I get the one new photo but also the following mesage:

Quote:
Error: Some albums not searched as they require upgrading to the latest version of Gallery first.

Not sure what that means as i did upgrade to the latest release of Gallery. Any ideas?

Bob

ps. Love your gallery page. It is so clean and nice. What is that theme?

 
myriagon

Joined: 2004-01-22
Posts: 130
Posted: Thu, 2004-05-06 20:57

Bob - floridave answered a query here about upgrading a while ago.

My website theme is something that I created myself.

Hope that helps.

Regards,

Jeremy
______________
Tearoom::Stats

 
rbrown3rd

Joined: 2003-04-23
Posts: 100
Posted: Thu, 2004-05-06 21:36

Nice job on the site. I really like the design and layout. Thanks for the help.

 
hollism16
hollism16's picture

Joined: 2004-03-03
Posts: 47
Posted: Fri, 2004-05-07 17:23

I don't know how many people have had problems getting stats.php to work with PHP-Nuke, but I just changed over to PHP-Nuke from the standalone version of Gallery and thought I'd share the info:

Add the following to index.php in your main Gallery directory:

                       "stats.php",
                       "stats.php?type=views",
                       "stats.php?type=date",
                       "stats.php?type=comments",
                       "stats.php?type=ratings",
                       "stats.php?type=random",

After you do that, it's just a matter of showing the correct URL's. I just added some links into my albums.php file in HTML right after

includeHtmlWrap("gallery.header");

It was on line 111 for me. Here's the code I put in there:

<center><br>
<a href="modules.php?op=modload&name=Media&include=stats.php&type=date"><b>Newest Items</b></a> ~
<a href="modules.php?op=modload&name=Media&include=stats.php&type=random"><b>Random Items</b></a><br><br>
<a href="modules.php?op=modload&name=Media&include=stats.php&type=ratings"><b>Highest Votes</b></a> ~
<a href="modules.php?op=modload&name=Media&include=stats.php&type=comments"><b>Latest Comments</b></a> ~
<a href="modules.php?op=modload&name=Media&include=stats.php&type=views"><b>Most Viewed</b></a><br><br>
</center>

My albums.php page can be found here if you want to see what it looks like.

Tailor that section to your own needs, but here are the URL's to the stats.php stuff- which was the difficult part for me to figure out (since I'm a php-idjit):

Newest images:
http://webhollis.com/site/modules.php?op=modload&name=Media&include=stats.php&type=date

Random images:
http://webhollis.com/site/modules.php?op=modload&name=Media&include=stats.php&type=random

Highest votes:
http://webhollis.com/site/modules.php?op=modload&name=Media&include=stats.php&type=ratings

Comments:
http://webhollis.com/site/modules.php?op=modload&name=Media&include=stats.php&type=comments

Most views:
http://webhollis.com/site/modules.php?op=modload&name=Media&include=stats.php&type=views

Obviously, the URL's will be different for your site, but there's a template for you to use.

Again, this is ONLY for people whose sites are running Gallery inside of PHP-NUKE.
Hope this helps some of you out! Laaaaaater~
Hollis

 
Terje-
Terje-'s picture

Joined: 2004-01-20
Posts: 90
Posted: Thu, 2004-05-13 09:13

We need to have a serious talk about caching/performance..
What would be the easiest way to implement a caching set?

 
Tbone

Joined: 2004-05-05
Posts: 11
Posted: Fri, 2004-05-14 03:51

I just added your stats script and love it. Exactly what I have been looking for, Thanks for all the hard work.

I am not very PHP savy so I'm hopeing you can help me on this one.

When I pull up the stats script it lists them all in one row. I have the rows set to 3 but it stilll is all in one row. I would like to have it in three rows with three colums like the rest of my gallery setup.

Is this an easy change? Thanks.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Fri, 2004-05-14 04:28

Tbone,
try this link: stats.php?type=date&period=0&sgr=1
the sgr=1 on the end will tell stats.php to "show grid" and you will have col and row settings (the default is 3 for each) See details in the readme or the top of the script.
and if you are using comments:
stats.php?type=comments&sgr=1
Full cusomizing with the hard codeded or URL variables.

Dave

 
Tbone

Joined: 2004-05-05
Posts: 11
Posted: Fri, 2004-05-14 05:10

That worked. Where can I find information like that?
Is that PHP?

REason I ask is I would like to remove the border lines inbetween now. I hate to keep askin youguys these questions if I cna look somewhere.

Can you point me in the right direction so I can look these up as I find them.

Any idea on the horizontal border line? Thanks for your help.

 
Shadow_Wolf
Shadow_Wolf's picture

Joined: 2004-04-03
Posts: 181
Posted: Fri, 2004-05-14 12:39

Is there a way to exclude certain Albums and/or Sub-Albums?

 
DarkunderdoG

Joined: 2003-08-16
Posts: 58
Posted: Sat, 2004-05-15 04:45

Is it possible for you to take a look at the CVS for 1.4.4 as Stats currently does not work.

Thank You!

Error i get is

Fatal error: Call to undefined function: pluralize_n() in /usr/local/share/doc/apache/gallery/stats.php on line 1324

Found Fix.. Had to change it to (pluralize_n2)

 
jeffclick

Joined: 2004-04-02
Posts: 2
Posted: Sun, 2004-05-23 03:22

If you're running Gallery embedded in PostNuke, here's how you can integrate this feature into your gallery:

Edit your index.php in modules/gallery/ and add "stats.php" into your list of permitted files to call.

From that point, you can call...

For most-recent additions:
www.yourdomain.com/modules.php?op=modload&name=Gallery&file=index&include=stats.php&type=date

For most-viewed:
www.yourdomain.com/modules.php?op=modload&name=Gallery&file=index&include=stats.php&type=views

And so forth, per the specific calls listed in the documentation.

 
myriagon

Joined: 2004-01-22
Posts: 130
Posted: Mon, 2004-05-24 19:49

Over the weekend I added caching support to the stats mod. The new version (2.00) can be downloaded here There are full details in the readme.

I've also pulled out the configuration data into stats.config.default.php (thanks Raven69 for the suggestion). If you want to use your own configuration then copy stats.config.default.php to stats.config.php and edit that file. This change should make upgrading a lot easier in future.

Caching improves performance for a large gallery at the cost of possibly displaying photos that are out of order or with old rating information (ratings are cached as they are time consuming to calculate). If you set the cache expiry time to a short time then this shouldn't be a problem.

There's a different cache for each stats type supported, with the exception of "random". Caching is off by default. A cache can be turned on by setting the 'On' variable such as $dateCacheOn to 1 in your stats.config.php file. Caches will refresh themselves after they have expired. The expiry time in seconds is specified for each cache in stats.config.php. If the expire time variable is set to -1 then the cache will not auto refresh. A cache can be also be refreshed manually by reloading the stats page and specifying the url variable 'refreshcache'.

The cache files are stored in the albumDir directory. Look for files called stats.<type>.cache - for example stats.views.cache. BTW don't hand edit the cache files - they include an index which you will break by editing.

Caching is not supported when stats is displaying information for a single album ('album' url specified) or when the 'period' url variable is specified. Performance should be less of a problem in these cases as typically there will be less images to analyze.

I've also added a new var url to show some basic timing info - 'stm' - for example stats.php?type=date&stm In testing caching made a significant performance difference particularly with a large number of images.

Page refresh time in seconds for 1550 images:
0.9, 1.9, 3.9 (cache, no cache, cache refresh)

...for 3478 images:
2.3, 5.3, 17.6 (cache, no cache, cache refresh)

It would be interesting to hear what performance other people get. That 17.6 figure seems large but thinking about it I'm doing lots of small disk writes which are probably the cause of the problem and will be easy to fix - but not tonight. It might be possible to make it even faster by loading only the albums that are required rather than all of them - but again not tonight.

Regards,

Jeremy

www.tearoom.me.uk

 
er16004
er16004's picture

Joined: 2004-03-19
Posts: 5
Posted: Sat, 2004-05-29 18:01
jeffclick wrote:
If you're running Gallery embedded in PostNuke, here's how you can integrate this feature into your gallery:

Edit your index.php in modules/gallery/ and add "stats.php" into your list of permitted files to call.

From that point, you can call...

For most-recent additions:
www.yourdomain.com/modules.php?op=modload&name=Gallery&file=index&include=stats.php&type=date

For most-viewed:
www.yourdomain.com/modules.php?op=modload&name=Gallery&file=index&include=stats.php&type=views

And so forth, per the specific calls listed in the documentation.

Does anyone know how to do this exact same thing using Mambo?

Thanks,

Eric

 
kai_tom

Joined: 2004-04-08
Posts: 347
Posted: Sun, 2004-05-30 11:08

Hi,

if your Gallery is embedded in Mambo as Component:

index.php?option=com_gallery&include=stats.php&type=views
for most viewed

For my Website i put this in a new Module:

<a href="/index.php?option=com_gallery&include=stats.php&type=date">Neuste Bilder</a><br>
<a href="/index.php?option=com_gallery&include=stats.php&type=views">Meistgesehene Bilder</a><br>
<a href="/index.php?option=com_gallery&include=stats.php&type=cdate">Sortiert nach Aufnahmedatum</a><br>
<a href="/index.php?option=com_gallery&include=stats.php&type=random">Zufällige Bilder</a>

Sorry for my bad english :oops:

Kai

 
manaan

Joined: 2004-02-14
Posts: 13
Posted: Thu, 2004-06-03 15:39

Please could someone let this novice know how to open the stats.tar file which I downloaded. It seems to be openeing up in encrypted code. I have got a gallery up an running. Do take a look. http://www.twilightbridge.com/op/gallery/
Manaan

 
jackc4317

Joined: 2003-12-25
Posts: 11
Posted: Mon, 2004-06-07 07:26

Use Winzip

 
midkiff

Joined: 2003-06-27
Posts: 70
Posted: Mon, 2004-06-07 19:17

I would like to know how to add more than just 10 pages at the top of the page. I am talking about Pages: 1 2 3..... and so on, I have read the readme and I don't know if I just overlooked it or what, can someone please help me with this, thanks!

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Mon, 2004-06-07 19:49

midkiff,
look for for ( $j = 1; $j <= $lastpage && $j <= 10; ++$j )and you should be able to change the 10 to somthing more sutable to your site.

BTW you also have the options for:
$photosPerPage = 10;
$totalPhotosToDisplay = 20; // Set to -1 for all photos.

Dave

 
priest
priest's picture

Joined: 2003-11-16
Posts: 5
Posted: Tue, 2004-06-08 06:24

I just recently installed your stats code and at first it seemed to be working great. But suddenly I've been getting this error message:

Fatal error: Allowed memory size of 8388608 bytes exhausted at (null):0 (tried to allocate 46 bytes) in /usr/local/apache/htdocs/modules/gallery/classes/Album.php on line 1462

I'm using Gallery embedded in PHP-Nuke.

I've tried a few times to read through all 17 pages of this thread to see if anyone else had this error and I couldn't find it. If I missed it then I apologize. I noticed in some of the earlier pages of this thread some different posts about memory limitations.

This error does NOT happen all the time. It seems to be random.

Thanks in advanced for all your hard work.

 
myriagon

Joined: 2004-01-22
Posts: 130
Posted: Tue, 2004-06-08 06:53

priest - sounds like it doesn't have enough memory - try using ini_set as described here

Regards,

Jeremy

www.tearoom.me.uk

 
bificypdog

Joined: 2004-03-15
Posts: 26
Posted: Tue, 2004-06-08 17:59

My Screen is blank.

I am using gallery and stats (2.00) as a postnuke-module.
Everything was fine. But now I see a blank screen. No error.
I have albums without any pictures. I use it as a placeholder, because my ISP gives me just 250 MB and I need more. I added all future galleries without any content.

max_execution_time = 50000
memory_limit = 40M
post_max_size = 8M
upload_max_filesize = 20M
$photosPerPage        = 10;
$totalPhotosToDisplay = -1;   // Set to -1 for all photos.

$showCaption          = 1;
$showAlbumLink        = 1;
$showDescription      = 1;
$showCaptureDate      = 1;
$showUploadDate       = 1;
$showViews            = 1;
$showVotes            = 0;    // Album.php and AlbumItem.php must be patched for this - see readme
$showRatings          = 0;    // Setting this to 1 may slow things down considerably...
$showComments         = 1;
$showAddComment       = 1;
$showAddVote          = 0;    // Album.php and AlbumItem.php must be patched for this - see readme
$showAlbumOwner       = 0;
$showGrid             = 0;
$newestCommentsFirst  = 1;
$numRows              = 3;
$numCols              = 3;

// Ideally date format should use the standard perl format string
// however the captureDate is stored in a non-standard format
// making it painful to support - hence this very simplified hack.
$captureDateFormat    = "D/M/Y";   // Only "M/D/Y" and "D/M/Y" supported

// Define the position where the Add Comment and Add Vote links are displayed.
// This can be any of the following:
//  'oncaptionline', 'abovestats', 'abovecomments', 'belowcomments'
$addLinksPos = 'belowcomments';

// To prevent an image with a small number of "excellent" votes being top rated,
// set the votesNeededToShowRating.
$votesNeededToShowRating = 5;

// Define the frame style.
// If this is undefined then the album's thumb framestyle is used.
// Valid values include all the styles supported by Gallery such as
// 'dots', 'solid', 'shadows', 'notebook'.
$frameStyle = 'solid';

// Define the pixel size of the image thumbs, for example $thumbSize = 72;
// If 'default' is specified, then the Gallery default thumbsize is used.
// This can also be overidden by the url variable, $tsz
$thumbSize = 'default';

// When displaying stats for a specific gallery using the $album url variable
// if $showNestedAlbums is set, then nested albums are included.
$showNestedAlbums = 1;

// Caching improves performance for a large gallery at the cost of potentially
// displaying photos that are out of order or with out of date rating information.
// There's a different cache for each stats type supported with the exception of random.
// A cache can be turned on by setting the 'On' variables below = 1.
// The caches can be refreshed by reloading the stats page and 
// specifying the url variable 'refreshcache'.
// Caches will also refresh themselves after they have expired.
// The expire time in seconds is specified for each cache below.
// If the expire time is set to -1 then the cache will not auto refresh.

$viewsCacheOn            = 0;
$viewsCacheExpireSecs    = 60;

$commentsCacheOn         = 0;
$commentsCacheExpireSecs = 600;

$dateCacheOn             = 0;
$dateCacheExpireSecs     = -1;  // cache does not expire.

$votesCacheOn            = 0;
$votesCacheExpireSecs    = 3600;

$ratingsCacheOn          = 0;
$ratingsCacheExpireSecs  = 3600;

$cDateCacheOn            = 0;
$cDateCacheExpireSecs    = -1;  // cache does not expire.
 
bificypdog

Joined: 2004-03-15
Posts: 26
Posted: Tue, 2004-06-08 18:16

I have activated the cache...

$viewsCacheOn            = 1;
$viewsCacheExpireSecs    = 360;

$commentsCacheOn         = 1;
$commentsCacheExpireSecs = 600;

$dateCacheOn             = 1;
$dateCacheExpireSecs     = 360; 

$votesCacheOn            = 1;
$votesCacheExpireSecs    = 3600;

$ratingsCacheOn          = 1;
$ratingsCacheExpireSecs  = 3600;

$cDateCacheOn            = 1;
$cDateCacheExpireSecs    = 360;

But no changes

 
myriagon

Joined: 2004-01-22
Posts: 130
Posted: Tue, 2004-06-08 18:17

bificypdog - I don't think I've seen this problem before... some questions...

- are you aware of anything that changed about the time it stopped working?
- what's the direct link so that I can see stats.php without postnuke?
- does the gallery search still work?

Just thought - looking at the debug it could be running out of memory so it might be worth trying ini_set to increase memory - see above.

Regards,

Jeremy

 
myriagon

Joined: 2004-01-22
Posts: 130
Posted: Tue, 2004-06-08 18:21

bificypdog - probably best to leave caching off for now until the standard code is working.