| Author |
Message |
dari
Site Admin


Joined: Mar 03, 2003 Posts: 6287 Location: Washington Township, NJ, USA
|
Posted: Tue Nov 04, 2003 1:49 pm Post subject: [TESTING] Newest Photo Block |
|
|
If you would be interested in testing the Newest Photo block, as seen on http://phpnuke.nukedgallery.net (lower left block), please post here. If there are enough responses, I will make it available for download.
This block scans your albums, and calculates the newest photo, based on upload date. The result is written to disk for speed purposes. The cache file is checked/updated once per hour to maintain a near real-time experience. |
|
| Back to top |
|
|
AdBot
|
| Post subject: [TESTING] Newest Photo Block |
|
|
|
|
|
| Back to top |
|
 |
dari
Site Admin


Joined: Mar 03, 2003 Posts: 6287 Location: Washington Township, NJ, USA
|
|
| Back to top |
|
|
plainrice
Beginner


Joined: Nov 01, 2003 Posts: 4
|
Posted: Wed Nov 05, 2003 4:43 am Post subject: |
|
|
Hi Dari, I've just tried to install the newest photo block. I have changed the path to reflect my gallery installation, but I get several errors. I am using php-nuke 6.9, and gallery 1.4.1 (i forget which cvs).
Taking the errors one at a time, I get a similar foreach() error as seen a lot in the random block. I have read your FAQ (D1), however, there is not a similar "session" variable to change as in the random block. Here are my exact errors:
Warning: Invalid argument supplied for foreach() in /homepages/12/d88411853/htdocs/blocks/block-NG-NewestPhoto.php on line 75
Warning: arsort() expects parameter 1 to be array, null given in /homepages/12/d88411853/htdocs/blocks/block-NG-NewestPhoto.php on line 85
Warning: First argument to array_keys() should be an array in /homepages/12/d88411853/htdocs/blocks/block-NG-NewestPhoto.php on line 86
ERROR: requested index [-1] out of bounds [0]
Fatal error: Call to a member function on a non-object in /homepages/12/d88411853/htdocs/modules/gallery/classes/Album.php on line 987
Line 75-ish area is:
Code: › function scanNewestPhoto() {
global $gallery, $albumDB;
foreach ($albumDB->albumList as $tmpAlbum) {
$name = $tmpAlbum->fields["name"];
$title = $tmpAlbum->fields["title"];
getNewestPhoto($name);
}
}
Any ideas?
-Geoff- |
|
| Back to top |
|
|
dari
Site Admin


Joined: Mar 03, 2003 Posts: 6287 Location: Washington Township, NJ, USA
|
Posted: Wed Nov 05, 2003 8:13 am Post subject: Re: [TESTING] Newest Photo Block |
|
|
| yep, i'm seeing it too...let me get a fix worked up. |
|
| Back to top |
|
|
dari
Site Admin


Joined: Mar 03, 2003 Posts: 6287 Location: Washington Township, NJ, USA
|
Posted: Wed Nov 05, 2003 8:31 am Post subject: |
|
|
ok, here's a patch, it should work just fine:
Code: ›
--- block-NG-NewestPhoto.php 2003-11-04 14:18:17.000000000 -0500
+++ block-NG-NewestPhoto-new.php 2003-11-05 08:26:11.000000000 -0500
@@ -38,12 +38,6 @@
define(NEW_PHOTO_CACHE,$gallery->app->albumDir."/newestphoto.cache");
$content = "";
-$albumDB = new AlbumDB(FALSE);
-
-$dateArray = array();
-$imageArray = array();
-$albumNameArray = array();
-
function getNewestPhoto($albumName, $depth=0) {
global $gallery, $dateArray, $imageArray, $albumNameArray;
@@ -70,7 +64,13 @@
}
function scanNewestPhoto() {
- global $gallery, $albumDB;
+ global $gallery, $dateArray, $imageArray, $albumNameArray;
+
+ $dateArray = array();
+ $imageArray = array();
+ $albumNameArray = array();
+
+ $albumDB = new AlbumDB(FALSE);
foreach ($albumDB->albumList as $tmpAlbum) {
$name = $tmpAlbum->fields["name"];
the lines with a "-" in front of them get deleted, the lines with a "+" in front of them get added in. an updated download has been posted. |
|
| Back to top |
|
|
plainrice
Beginner


Joined: Nov 01, 2003 Posts: 4
|
Posted: Wed Nov 05, 2003 11:44 am Post subject: |
|
|
| That worked. Thanks a bunch for your work and support. |
|
| Back to top |
|
|
plainrice
Beginner


Joined: Nov 01, 2003 Posts: 4
|
Posted: Wed Nov 05, 2003 8:21 pm Post subject: |
|
|
| Found another small problem. The newest photo seems to show up fine, but when you click on the photo or the album, an error page comes up: "Sorry, such file doesn't exist..." The address in the location bar it's trying to load is: "http://www.plainrice.com/modules.php?set_albumName=arborfest08312002&id=My_Pictures0024&op=modload&name=&file=index&include=view_photo.php" |
|
| Back to top |
|
|
Stevesteve
Beginner


Joined: Sep 09, 2003 Posts: 13
|
Posted: Thu Nov 06, 2003 2:04 am Post subject: |
|
|
I get this as well. The problem appears to be that "name" is blank.
eg op=modload&name=&file=index
where it should be
op=modload&name=gallery&file=index
If you add "gallery" to the url it works fine, how do we update the blocks? On my (new) site both blocks are having the problem (block-NG-mostPopular and block-NG-NewestPhoto)
eg http://www.getitindia.net
Cheers,
Steve  |
|
| Back to top |
|
|
efurban
Beginner


Joined: Nov 01, 2003 Posts: 5
|
Posted: Thu Nov 06, 2003 4:42 am Post subject: Re: [TESTING] Newest Photo Block |
|
|
here is the solution (hehe, my first post here):
1. change $GALLERY_MODULENAME to $GALLERY_MODULENAME_LOCAL
at the beginning, as well as in the readNewestPhoto() function of the original code
2. in readNewestPhoto() function, add
$GALLERY_MODULENAME=$GALLERY_MODULENAME_LOCAL;
after the global $balabalabal.... line.
done!
let me know if you have any problem.
 |
|
| Back to top |
|
|
plainrice
Beginner


Joined: Nov 01, 2003 Posts: 4
|
Posted: Thu Nov 06, 2003 1:56 pm Post subject: |
|
|
Stevesteve wrote: › I get this as well. The problem appears to be that "name" is blank.
eg op=modload&name=&file=index
where it should be
op=modload&name=gallery&file=index
If you add "gallery" to the url it works fine
Agreed, that seems to work. I'm gonna look through the code to see what I can find....Dari a lil' help tho? |
|
| Back to top |
|
|
dari
Site Admin


Joined: Mar 03, 2003 Posts: 6287 Location: Washington Township, NJ, USA
|
Posted: Thu Nov 06, 2003 2:19 pm Post subject: |
|
|
hmm..well the latest code bunch available should work, depending on your gallery version. The GALLERY_MODULENAME variable should work, though it may just be available on the 1.4.1 CVS version (which you should upgrade to once it is finally released..lots of cool features ). |
|
| Back to top |
|
|
Stevesteve
Beginner


Joined: Sep 09, 2003 Posts: 13
|
Posted: Thu Nov 06, 2003 5:55 pm Post subject: |
|
|
i'm using the same cvs version of gallery as you guys, v1.4.1-cvs-b208 so it shouldn't be a problem with the gallery itself.
I.ve made the changes suggested by efurban but no luck....i must be missing something.. will keep looking
Thanks for your help,
Steve |
|
| Back to top |
|
|
islandman
Beginner


Joined: Nov 06, 2003 Posts: 1
|
|
| Back to top |
|
|
Stevesteve
Beginner


Joined: Sep 09, 2003 Posts: 13
|
Posted: Sun Nov 09, 2003 6:31 pm Post subject: |
|
|
fixed!
in the newest block files, after the line "global $gallery;" (about line 30)
add
"global $GALLERY_MODULENAME;" (without the quotes obviously).
It works with or with out the changes efurban mentions above. I've installed googletap and this block works fine now, i guess i would work normally as well.
good luck,
Steve |
|
| Back to top |
|
|
JConnell
Beginner


Joined: Dec 05, 2003 Posts: 7 Location: Northwest, USA
|
Posted: Thu Dec 11, 2003 9:17 am Post subject: Re: [TESTING] Newest Photo Block |
|
|
I have just discovered and installed this block on my site (Nuke 6.9+Gallery 1.4.1). It works great, but I'm having one problem:
I have two galleries. One has "everybody" for permissions, and the other has "logged in" for permissions. However this block is showing pictures from the "logged in" album to guests.
I know the random photo block does not do this, so maybe its easy to add? Sorry I don't have any php knowledge I am just curious if someone could help me. |
|
| Back to top |
|
|
|
|
|
|
|