Topic Title: [RELEASE] Random Photo V2

Forum Index » Blocks » [RELEASE] Random Photo V2
Topic URL: http://www.nukedgallery.net/postt603.html

AuthorMessage
Post Title: [RELEASE] Random Photo V2
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Sat Jan 24, 2004 6:02 pm
It's been tested and debugged. Get it here:
http://www.nukedgallery.net/download-file-30.html

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
slackbladder
Joined: Mar 29, 2003
Posts: 1038
Location: Cambs,UK
Posted: Sun Jan 25, 2004 5:20 am
Yep like it!

Only problem I had (being MAC based) is the file name is too long (block-NG-RandomPhoto_functions.php) but only for my APPLICATION (GoLive) - it's OK for my server (MAC UNIX/darwin).

Also might be an idea to rename without the word 'block' at the beginning as it then appears in the 'dropdown' in blocks admin.

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Sun Jan 25, 2004 9:20 am
ahh..good point slack...done and done Smile

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
gravityarc
Joined: Aug 29, 2003
Posts: 22

Posted: Mon Jan 26, 2004 1:42 am
I'm having an issue with the height of the block. When I use AUTO there are some height problems. The block will take the height of the first image and text it displays, but then won't re-evaluate for further images. If I happen to get a horizontal image first, then I get a vertical one, either the text or image gets cut-off for the vertical one.

Hardcoding it is difficult too because if I do 200, then it works for most, but there tends to be a lot of blank space in horizontal images, and some text gets cut off for vertical ones. (I'm editing this in $content in block-NG-RandomPhoto.php by the way.)

Any suggestion on how to make it display horizontal and vertical pictures with varying amounts of text without cutting off anything or displaying lots of blank space?

Thanks!

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Mon Jan 26, 2004 8:17 am
hmm...this is a good point (and the first time it's been raised)....i'll have to look into this and see what methods are available to dynamically resize blocks (without reloading the entire page).

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
gravityarc
Joined: Aug 29, 2003
Posts: 22

Posted: Mon Jan 26, 2004 10:59 pm
If anyone's interested, there's a way to smooth your scrolling for when you use the RANDOM settings. In block-NG-RandomPhoto.php I changed the marquee settings to:
Code: › $content .= "<marquee loop=\"infinite\" direction=\"up\" title=\"Click here to view this picture\" behavior=\"scroll\" align=\"center\" scrollamount= \"1\" scrolldelay=\"45\" height=\"200\" onmouseover='this.stop()' onmouseout='this.start()'>";

The key changes are I changed scrollamount from 2 to 1, and scrolldelay from 60 to 45. This creates a very smooth scrolling effect. (I also changed the height from 220 to 200 so it doesn't take up quite as much room.)

The new Random Photo block is very cool!

Do you have any plans on making it so that you can choose which albums to include in the Random block (or choose which albums to exclude) rather than have it choose from all available albums?

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Tue Jan 27, 2004 8:19 am
thanks for the hack Smile

as for choosing albums...maybe, as that would take quite a bit of code manipulation to add in an admin interface to allow for it...but, i'll stick it on my things to do list Smile

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
Antra
Joined: Oct 30, 2003
Posts: 2

Posted: Tue Jan 27, 2004 11:42 am
Keeps telling me that floatval() isn't a defined function. Where the heck is it?

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Tue Jan 27, 2004 11:53 am
this question has been answered and asked in these forums before at http://www.nukedgallery.net/posts475-hi ... tval.html, but i'm feeling nice Wink so i'll answer it here, too.
you're using an oooold version of php: http://www.php.net/floatval (note that it's available for PHP >= 4.2.0).

use this syntax instead:
PHP: › <?php $foo = (float)$foo?>

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
Antra
Joined: Oct 30, 2003
Posts: 2

Posted: Tue Jan 27, 2004 10:54 pm
Thanks...I thought we had a fairly recent version of PHP, but I guess not :-/. Is 4.0 really that old?

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Wed Jan 28, 2004 7:53 am
very old. current version is 4.3.4 with 5.0 in beta. tell your provider to upgrade, there are LOADS of security issues w/ versions that old.

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Wed Jan 28, 2004 10:57 am
dari wrote: › thanks for the hack Smile

as for choosing albums...maybe, as that would take quite a bit of code manipulation to add in an admin interface to allow for it...but, i'll stick it on my things to do list Smile


Alrighty, you can grab a testing version of a selectable random block here:
http://www.nukedgallery.net/download-file-37.html

When you log into your nuke site as admin, you will be presented with a list of your albums. Check the ones you want included, and click the "Save" button. Once you've logged out as admin, you should see only photos from your chosen albums in the block. See the demo at the demo site [nukedgallery.net]. I selected to only allow photos from the "Christmas 2001" album to be chosen.

Note that when you add new albums, or new photos to existing albums, you will have to go through the admin interface and re-select the album so that the correct number of photos is stored in the cache.

File all bugs/complaints/etc, to this thread:
http://www.nukedgallery.net/postp3841.html

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
lytspeed
Joined: Jul 06, 2004
Posts: 2

Posted: Sun Jul 11, 2004 4:00 am
Warning: fopen(/home/thefaste/public_html/albums/block-random.cache): failed to open stream: Permission denied in /home/thefaste/.panel/web/portal/cms/blocks/NG-RandomPhoto_functions.php on line 221

Warning: fwrite(): supplied argument is not a valid stream resource in /home/thefaste/.panel/web/portal/cms/blocks/NG-RandomPhoto_functions.php on line 223

Warning: fclose(): supplied argument is not a valid stream resource in /home/thefaste/.panel/web/portal/cms/blocks/NG-RandomPhoto_functions.php on line 225

Fatal error: Call to undefined function: isalbumname() in /home/thefaste/.panel/web/portal/cms/blocks/NG-RandomPhoto_functions.php on line 101


These are the errors I get when I turn on the random block. I am a noob, but loaded gallery fine - gallery works nicely - latest version 1.4.3 I think. Also, runnin nuke 4.2

Any help would be appreciated!

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
valerie
Joined: Dec 16, 2003
Posts: 9

Posted: Mon Jul 26, 2004 4:44 pm
Wow! I love it! Works great. How hard would it be to make it scroll horizontally as a center block? I tried for a while but I couldn't figure out how to prevent the block from being as tall as the number of images I specified. In any event, thanks for such a great block.

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
pokep
Joined: May 02, 2004
Posts: 1

Posted: Tue Aug 03, 2004 4:13 pm
Not working on 1.4.4

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
sgn2
Joined: Aug 08, 2004
Posts: 1

Posted: Mon Aug 09, 2004 9:15 pm
1.4.4 fix?

Fatal error: Call to undefined function: isalbumname() in

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
jdlejeune
Joined: Jul 19, 2004
Posts: 1

Posted: Tue Aug 10, 2004 11:45 am
I'm new to this. I've placed the files in my Blocks folder. I go to blocks in admin and under "add a new block" I type:

Name: Random Photo
Filename: NG-RandomPhotoSelectTest
Position: Right
Activate: yes
Expiration: 0 days
After expiration: deactivate
Who can view..: All Visitors
Visible to Subscribers: Yes

Why can't I see it??

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
agarcha
Joined: Oct 15, 2003
Posts: 2

Posted: Wed Aug 11, 2004 6:08 am
I am getting the same error as sgn2 "Fatal error: Call to undefined function: isalbumname()" something to do with line 101. Help!

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
dvsj
Joined: Aug 13, 2004
Posts: 1

Posted: Fri Aug 13, 2004 5:11 am
I too am getting an error with 1.4.4

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Fri Aug 13, 2004 6:54 am
i haven't had the time to go through the blocks and check for code changes that need to be made in light of the 1.4.4 release. Gallery evolves more and more with each release, making it difficult for the "little guys" like me to keep up Wink

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
aimana
Joined: Aug 01, 2003
Posts: 1

Posted: Fri Aug 13, 2004 1:20 pm
works on my implementation of 1.4.4 and nuke 7.3

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
GJSchaller
Joined: Aug 04, 2004
Posts: 37
Location: Valhalla, NY, USA
Posted: Mon Aug 16, 2004 4:10 pm
I'm getting the same error on line 101 - Gallery 1.4.4, Nuke 7.4

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
nickg
Joined: Aug 26, 2004
Posts: 1

Posted: Thu Aug 26, 2004 8:43 am
hi - a small bug i've found on NG-RandomPhoto_funcitons.php

when the random photo block is installed in phpnuke and you set it to AUTO (from the block-NG-RandomPhoto.php file) - a link shows on your block where you can acces the gallery directly, you click it and the link opens up inide the block

its becasue of this in NG-RandomPhoto_functions.php

$FROM = "From: <a href=\"$ALBUM_URL\">" . $album->fields['title'] . '</a>';

there is nothing to tell it to open a new window so i added target=\"_top\"

and that fixed it. - so now i go into the photoalbum directly !

$FROM = "From: <a href=\"$ALBUM_URL\" target=\"_top\" >" . $album->fields['title'] . '</a>';

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
twelves
Joined: Jul 31, 2003
Posts: 14

Posted: Sat Oct 02, 2004 11:10 am
Fatal error: Call to undefined function: isalbumname()

Count me in watching this thread also.

Rolling Eyes

nuke 7.5 (Patched)
Final version of PHP
Linux server

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
twelves
Joined: Jul 31, 2003
Posts: 14

Posted: Sat Oct 02, 2004 11:16 am
Wooops, Did more digging and found this.

I hope I can make a small donation this year. Might have a real job now!



You will either need to change ALL refs to isAlbumName to getAlbumName or downgrade to 1.4.2 until Dari (site admin) has revised the RANDOM BLOCK code (my guess is this won't be done until 1.4.3 is on public release) Wink

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
-JiF-Mike
Joined: Oct 12, 2004
Posts: 1
Location: NH
Posted: Tue Oct 12, 2004 11:51 am
I replaced isAlbumName with getAlbumName and that fixed it for me. Smile Thanx for the info!

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
Ricasso
Joined: Oct 15, 2004
Posts: 1

Posted: Sat Oct 16, 2004 6:58 am
Is anyone having a problem with the "random" function of the block? I have my block set to scroll three images vertically but they are sometimes not as random as I would like... i.e. sometimes the same thumbnail shows twice. Is there a something that I need to tweak in the random function?

My block is in the lower right-hand corner: http://www.seekers-hq.com/portal [seekers-hq.com]


And I just want to say thanks for all the hard work you've done keeping up with the Gallery releases.

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
martinn
Joined: Sep 19, 2004
Posts: 2

Posted: Sat Oct 16, 2004 4:25 pm
I am getting error:

Fatal error: main(): Failed opening required '/wartwoa/public_html/modules/gallery/init.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/wartwoa/public_html/blocks/NG-RandomPhoto_functions.php on line 61

i am using v 1.4.4
nuke 7.4

is this why, or can i fix??

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Sat Oct 16, 2004 5:02 pm
martinn,
you need to specify the ABSOLUTE path in your block config:
/home/wartwoa/public_html/modules/gallery/

Ricasso,
The randomness is a function of how many pictures are in each album. So, if you have three albums, one with 100 images, one with 10, and another with 5, the album with 100 images will be chosen more than the other two. and, when the others are chosen, they may show duplicates. you can delete the block-random.cache file and see if that helps.

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
martinn
Joined: Sep 19, 2004
Posts: 2

Posted: Sun Oct 17, 2004 4:28 pm
ok changed to absolute path
changed all references to isAlbumName to getAlbumName
now i get a scrolling image in the block but under all these error messages:

Warning: fopen(/wartwoa/public_html/albums/block-random.cache): failed to open stream: No such file or directory in /home/wartwoa/public_html/blocks/NG-RandomPhoto_functions.php on line 221

Warning: fwrite(): supplied argument is not a valid stream resource in /home/wartwoa/public_html/blocks/NG-RandomPhoto_functions.php on line 223

Warning: fwrite(): supplied argument is not a valid stream resource in /home/wartwoa/public_html/blocks/NG-RandomPhoto_functions.php on line 223

Warning: fwrite(): supplied argument is not a valid stream resource in /home/wartwoa/public_html/blocks/NG-RandomPhoto_functions.php on line 223

Warning: fwrite(): supplied argument is not a valid stream resource in /home/wartwoa/public_html/blocks/NG-RandomPhoto_functions.php on line 223

Warning: fwrite(): supplied argument is not a valid stream resource in /home/wartwoa/public_html/blocks/NG-RandomPhoto_functions.php on line 223

Warning: fwrite(): supplied argument is not a valid stream resource in /home/wartwoa/public_html/blocks/NG-RandomPhoto_functions.php on line 223

Warning: fwrite(): supplied argument is not a valid stream resource in /home/wartwoa/public_html/blocks/NG-RandomPhoto_functions.php on line 223

Warning: fwrite(): supplied argument is not a valid stream resource in /home/wartwoa/public_html/blocks/NG-RandomPhoto_functions.php on line 223

Warning: fwrite(): supplied argument is not a valid stream resource in /home/wartwoa/public_html/blocks/NG-RandomPhoto_functions.php on line 223

Warning: fwrite(): supplied argument is not a valid stream resource in /home/wartwoa/public_html/blocks/NG-RandomPhoto_functions.php on line 223

Warning: fwrite(): supplied argument is not a valid stream resource in /home/wartwoa/public_html/blocks/NG-RandomPhoto_functions.php on line 223

Warning: fwrite(): supplied argument is not a valid stream resource in /home/wartwoa/public_html/blocks/NG-RandomPhoto_functions.php on line 223

Warning: fwrite(): supplied argument is not a valid stream resource in /home/wartwoa/public_html/blocks/NG-RandomPhoto_functions.php on line 223

Warning: fwrite(): supplied argument is not a valid stream resource in /home/wartwoa/public_html/blocks/NG-RandomPhoto_functions.php on line 223

Warning: fwrite(): supplied argument is not a valid stream resource in /home/wartwoa/public_html/blocks/NG-RandomPhoto_functions.php on line 223

Warning: fwrite(): supplied argument is not a valid stream resource in /home/wartwoa/public_html/blocks/NG-RandomPhoto_functions.php on line 223

Warning: fwrite(): supplied argument is not a valid stream resource in /home/wartwoa/public_html/blocks/NG-RandomPhoto_functions.php on line 223

Warning: fwrite(): supplied argument is not a valid stream resource in /home/wartwoa/public_html/blocks/NG-RandomPhoto_functions.php on line 223

Warning: fwrite(): supplied argument is not a valid stream resource in /home/wartwoa/public_html/blocks/NG-RandomPhoto_functions.php on line 223

Warning: fwrite(): supplied argument is not a valid stream resource in /home/wartwoa/public_html/blocks/NG-RandomPhoto_functions.php on line 223

Warning: fwrite(): supplied argument is not a valid stream resource in /home/wartwoa/public_html/blocks/NG-RandomPhoto_functions.php on line 223

Warning: fwrite(): supplied argument is not a valid stream resource in /home/wartwoa/public_html/blocks/NG-RandomPhoto_functions.php on line 223

Warning: fwrite(): supplied argument is not a valid stream resource in /home/wartwoa/public_html/blocks/NG-RandomPhoto_functions.php on line 223

Warning: fwrite(): supplied argument is not a valid stream resource in /home/wartwoa/public_html/blocks/NG-RandomPhoto_functions.php on line 223

Warning: fwrite(): supplied argument is not a valid stream resource in /home/wartwoa/public_html/blocks/NG-RandomPhoto_functions.php on line 223

Warning: fwrite(): supplied argument is not a valid stream resource in /home/wartwoa/public_html/blocks/NG-RandomPhoto_functions.php on line 223

Warning: fwrite(): supplied argument is not a valid stream resource in /home/wartwoa/public_html/blocks/NG-RandomPhoto_functions.php on line 223

Warning: fclose(): supplied argument is not a valid stream resource in /home/wartwoa/public_html/blocks/NG-RandomPhoto_functions.php on line 225


anything else i can try???

gallery 1.4.4
Nuke 7.4

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
rioguia
Joined: Nov 16, 2003
Posts: 12

Posted: Tue Nov 02, 2004 8:11 pm
lytespeed's question has already been answered. See
http://www.nukedgallery.net/posts786-hi ... mname.html

this is a known bug for block-NG-RandomPhotoV2 for all galleries equal to or greater than GALLERY 1.4.3.

you need to edit the NG-RandomPhoto_functions.php. Replace every instance (about five) of the function, isAlbumName with the function getAlbumName .

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
dulcis
Joined: Nov 02, 2004
Posts: 2

Posted: Thu Nov 04, 2004 11:06 am
Quote: › martinn,
you need to specify the ABSOLUTE path in your block config:
/home/wartwoa/public_html/modules/gallery/


I get the same error as martinn!

Fatal error: main(): Failed opening required '/home/public_html/modules/gallery/init.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/partyrun/public_html/blocks/NG-RandomPhoto_functions.php on line 61

I changed the ABSOLUTE path like this and still get the error?

$GALLERY_BASEDIR = "/home/public_html/modules/gallery/";

Anybody know what I'm doing wrong??[/i]

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Thu Nov 04, 2004 11:10 am
you didn't specify your directory properly:
/home/partyrun/public_html/modules/gallery/

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
dulcis
Joined: Nov 02, 2004
Posts: 2

Posted: Thu Nov 04, 2004 11:28 am
That fixed the problem! Thanks! Although I am now getting the same error as all the others:

Fatal error: Call to undefined function: isalbumname() in

No solution yet?

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Thu Nov 04, 2004 11:30 am
please search the forums, this has been answered before.

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
c4m_t
Joined: Nov 04, 2004
Posts: 1

Posted: Thu Nov 04, 2004 5:26 pm
Hi there, i'm getting this error when running your code:
Fatal error: Call to undefined function: fs_file_exists() in /home/camtindall/www/www/blocks/NG-RandomPhoto_functions.php on line 192
On line 192 is
Code: › if (fs_file_exists(CACHE_FILE)) {

Using PHP Nuke 7.4 Gallery v1.4.4-pl2
Any help please?
edit: problem solved now Smile

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
rioguia
Joined: Nov 16, 2003
Posts: 12

Posted: Fri Nov 05, 2004 1:42 pm
i am having the same memory error problem noted earlier but have not found a solution. i have the latest cv release of gallery(1.5?) with the random-block functions modified (edited the NG-RandomPhoto_functions.php. file by replacing every instance of the function, "isAlbumName" with the function "getAlbumName."). My gallery is inbedded in nuke 7.3 and running on fedora core 2 / apache 2.05.
i suspect that is because my gallery has over 4000 pics (i have kids and distant family). i've tried the settings AUTO, RANDOM, etc.

the prior poster mentioned that this might be a php/apache issue but his host would not address the problem. i'd be happy to make any adjustments to my server to accomodate this probem if someone would give me some suggestions (or terms to google on)

specifc errors i get are:
i get errors in my log
/var/log/httpd/www.primary.com_errors

PHP Fatal error: Allowed memory size of 8388608
bytes exhausted (tried to allocate 20 bytes) in
/var/www/html/modules/gallery/classes/Album.php on line 783

Code: ›    function loadPhotosFromFile($filename) {
                $tmp = unserialize(getFile($filename));
                if (!is_Array($tmp)){
line 783 --->    $tmp = unserialize(getFile($filename, true));
                        if (!is_Array($tmp)){
                                return 0;
                        }
                }
                if (count($tmp) > 0) {
                        if (strcasecmp(get_class($tmp[0]), "albumitem")) {
                                /* Dunno what we unserialized .. but it
wasn't an album! */
                                return 0;

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
jasperguy
Joined: Apr 23, 2003
Posts: 1

Posted: Tue Dec 07, 2004 12:22 am
Hello,

Has anyone seen this one:

Fatal error: Call to a member function on a non-object in /var/www/html/phpnuke/mainfile.php on line 84

For the above error, I found out that some of the albums could not be indexed. It could the large ones, i'm not too sure. I have now used only a few albums for the random.

I'm using Nuke 7x and Gallery 1.4.4
I tweaked --> isalbumname to GetAlbumName <- successful
I tweaked --> define(CACHE_FILE, ALBUM_DIRECTORY."albums.cache"); <--successful

My random photo block is now working.

Thanks, everything is all good now. Dec 07, 2004

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
GJSchaller
Joined: Aug 04, 2004
Posts: 37
Location: Valhalla, NY, USA
Posted: Thu Dec 09, 2004 5:07 pm
I have the block installed, and it looks good.

However, now when I try to access the Galley in any way - either thru the Block, or direclty from Nuke, I get the following message:

"Sorry, such file doesn't exist..."

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
GJSchaller
Joined: Aug 04, 2004
Posts: 37
Location: Valhalla, NY, USA
Posted: Thu Dec 09, 2004 5:52 pm
Never mind... I forgot I capatalized the folder "Gallery" - forgot to change that in the Module Name in the config. I had it right in the path, but not in the name. It's working fine now.

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
GJSchaller
Joined: Aug 04, 2004
Posts: 37
Location: Valhalla, NY, USA
Posted: Tue Dec 14, 2004 12:32 pm
OK, the block is installed, and runs fine. But since it was installed, the site has slowed to a crawl... where load times used to be less than a second, a single page takes up to 5 seconds to load on a fast broadband connection.

I've tried deleting the block, removing all the files, and it's still slow. Anyone else running into a speed issue, or is there a setting / change I missed that I need to undo?

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
GJSchaller
Joined: Aug 04, 2004
Posts: 37
Location: Valhalla, NY, USA
Posted: Fri Dec 17, 2004 5:49 pm
*sigh* Back up to speed.

Apparently somewhere at the same time I was uploading the block, either a header file or my DB files got corrupted - they worked, but terribly slow. I wound up re-uploading all the base Nuke files, and it began working normally again.

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
GJSchaller
Joined: Aug 04, 2004
Posts: 37
Location: Valhalla, NY, USA
Posted: Thu Dec 30, 2004 9:27 am
Right, third try is the charm....

My Gallery works fine, and can be accessed normally. The Random Photo Block brings up a random image properly. But when anyone clicks on the random image to take them to the larger picture, they get the following:

Quote: › Error: Requested index [0] out of bounds [108]
Fatal error: Call to a member function on a non-object in /home/kradmin/public_html/modules/Gallery/classes/Album.php on line 1258


Changes that may have affected this:

* I recently enabled a bunch of security in NukeSentinel 2.1.3.

* PHP 4.3.10 was recently installed on my server, along with the ZEND update.

Any idea how to fix this?

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
slackbladder
Joined: Mar 29, 2003
Posts: 1038
Location: Cambs,UK
Posted: Thu Dec 30, 2004 10:54 am
Seems to also be working for ALL of your images Sad

Have you tried a FRESH install (or at least the CLASSES folder, as it works fine as standalone)?

Also try a different theme if you can (may be conflict in code)

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
GJSchaller
Joined: Aug 04, 2004
Posts: 37
Location: Valhalla, NY, USA
Posted: Thu Dec 30, 2004 11:07 am
I only have the one theme - we've got it restricted to keep the feel of the site the way we'd like it.

Whoops - I hadn't realized it failed for the images in the Gallery, too... I'm doing a re-install now. Will let you know if it works.

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
GJSchaller
Joined: Aug 04, 2004
Posts: 37
Location: Valhalla, NY, USA
Posted: Thu Dec 30, 2004 11:14 am
Still getting the error. When I access the gallery directly:

http://www.knightrealms.com/modules/Gallery/

It works fine, though, so it's something to do with Nuke.

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
slackbladder
Joined: Mar 29, 2003
Posts: 1038
Location: Cambs,UK
Posted: Thu Dec 30, 2004 11:15 am
The reason for trying a diff theme is to only determine if the theme is at fault. You can easily upload a 'standard' nuke theme and only change YOUR prefences to use the temp theme.

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
GJSchaller
Joined: Aug 04, 2004
Posts: 37
Location: Valhalla, NY, USA
Posted: Thu Dec 30, 2004 11:32 am
Same thing with the Nuke News theme. Crying or Very sad

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
slackbladder
Joined: Mar 29, 2003
Posts: 1038
Location: Cambs,UK
Posted: Thu Dec 30, 2004 11:52 am
Hmn - have you done any amends to any of NUKES core files? (modules.php, mainfile.php, etc). The problem must be with your Nuke install! Confused

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
GJSchaller
Joined: Aug 04, 2004
Posts: 37
Location: Valhalla, NY, USA
Posted: Thu Dec 30, 2004 12:02 pm
Possibly, for the Sentinel - although it was working previously (I installed it and let the files sit for a while inactive), all I did was enable the security options. I'll turn them off one at a time, see if one of them does it.

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
GJSchaller
Joined: Aug 04, 2004
Posts: 37
Location: Valhalla, NY, USA
Posted: Thu Dec 30, 2004 12:09 pm
That's not it either - I disabled all the Security in NukeSentinel, and still no luck. Erg.

Let me go fishing thru what changes I made to see if one of them did it - can someone help me narrow down what would affect this / what files to look at, that would affect this linking?

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
slackbladder
Joined: Mar 29, 2003
Posts: 1038
Location: Cambs,UK
Posted: Thu Dec 30, 2004 12:24 pm
Have a look in your webspace error.log (if you have access).

I would try these first:

header.php
footer.php
modules.php
mainfile.php

Also try your .htaccess (if there is one)

Maybe an easier option might be to install a fresh copy of NUKE in to a seperate folder (yoursite/test/) using same version as existing site and use existing DB (all depends on what changes you have done) - to test if it is in fact a problem with your NUKE install and not a server problem.

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
GJSchaller
Joined: Aug 04, 2004
Posts: 37
Location: Valhalla, NY, USA
Posted: Thu Dec 30, 2004 8:00 pm
No dice. I took out all the security changes in each of those files, and removed .htaccess from any folders above Gallery or Albums, and it did not resolve the error.

A few things I did notice:

My PHPinfo: http://www.knightrealms.com/phpinfo.html
(I saved it as a HTML from the Gallery Diags)

I'm using Gallery 1.4.4-pl4. I've done a complete upload / overwrite, and re-run the Config Wizard.

The error affects both the Block and individual photos in the Gallery, but not sub-albums. It does not affect the gallery when viewed in stand-alone mode.

I noticed that when you get the error, one of the numbers changes:

Quote: › Error: Requested index [0] out of bounds [XXX]
Fatal error: Call to a member function on a non-object in /home/kradmin/public_html/modules/Gallery/classes/Album.php on line 1258


The [XXX] changes according to the album it is in, but is consistent for all the photos in an the same album.

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
GJSchaller
Joined: Aug 04, 2004
Posts: 37
Location: Valhalla, NY, USA
Posted: Fri Dec 31, 2004 1:14 pm
OK, I uploaded a seperate version of Nuke, and Gallery, pointed at the same albums - and it works. This means it's most definately my Nuke setup, and not PHP & ZEND - Argh!

Time to slog thru the files, one at a time...

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
kuebel
Joined: Oct 26, 2004
Posts: 3

Posted: Sat Jan 01, 2005 12:01 pm
hi,
i've got the same problems since i installed nuke sentinel. when i disable the sentinel by delete the sentinel lines from mainfile.php my gallery works fine...

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
GJSchaller
Joined: Aug 04, 2004
Posts: 37
Location: Valhalla, NY, USA
Posted: Sat Jan 01, 2005 5:26 pm
I did replace my minafile.php - it fixed the issue. I'm going to try re-editing the files carefully to see if I can figure out what caused it.

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
GJSchaller
Joined: Aug 04, 2004
Posts: 37
Location: Valhalla, NY, USA
Posted: Sun Jan 02, 2005 11:02 am
Yeah, that's it, I somehow missed it on my first run. I'll start a new thread since this isn't only the block, it's all of Gallery.

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
alx
Joined: Jan 08, 2005
Posts: 6

Posted: Mon Jan 17, 2005 8:05 pm
c4m_t wrote: › Hi there, i'm getting this error when running your code:
Fatal error: Call to undefined function: fs_file_exists() in /home/camtindall/www/www/blocks/NG-RandomPhoto_functions.php on line 192
On line 192 is
Code: › if (fs_file_exists(CACHE_FILE)) {

Using PHP Nuke 7.4 Gallery v1.4.4-pl2
Any help please?
edit: problem solved now Smile


How do you solved it? i have the same problem.

Thank's!

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
PendragonIV
Joined: Jan 15, 2005
Posts: 6

Posted: Sat Jan 22, 2005 5:02 pm
VAlarie asked this earlier
Quote: › Wow! I love it! Works great. How hard would it be to make it scroll horizontally as a center block? I tried for a while but I couldn't figure out how to prevent the block from being as tall as the number of images I specified. In any event, thanks for such a great block.
I have same question. I love the block but would like horizontal scrolling if possible. Any suggestions?

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Tue Feb 01, 2005 3:48 pm
i'm not too sure if horozontal scrolling is possible.

<checks at http://www.blooberry.com/indexdot/html/ ... arquee.htm >

Hmm...looks like it might be. try tweaking the code to use a horozontally scrolling marquee instead of a vertically scrolling one.

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
Jaxe
Joined: May 02, 2004
Posts: 8

Posted: Wed Feb 09, 2005 1:36 pm
Hi,

I have PHPNuke 7.5 and Gallery 1.4.4. Tried to install the block-NG-RandomPhotoV2SelectTest, but I'm having some problems:

1. It doesn't create the block-random.cache in my album dir. I have tried to create an empty file myself.

I have replaced all isAlbumName with getAlbumName.

2. I get the following error displayed inside my Random Block:

Quote: › Warning: main(blocks/block-NG-RandomPhotoSelectTest_functions.php): failed to open stream: No such file or directory in /var/www/whacked/block-NG-AutoPhoto.php on line 6

Warning: main(): Failed opening 'blocks/block-NG-RandomPhotoSelectTest_functions.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/whacked/block-NG-AutoPhoto.php on line 6


Fatal error: Call to undefined function: get_photo() in /var/www/whacked/block-NG-AutoPhoto.php on line 18


You can see the module on: http://whacked.dk [whacked.dk]

Configs:
block-NG-RandomPhotoSelectTest.php
Code: ›
/*******************************************************************/
/* Full path to your albums directory, don't forget the trailing / */
/*******************************************************************/
define(ALBUM_DIRECTORY,"/var/www/whacked/albums/");

/*******************************************************************/
/* Valid values for $selector: "DAILY", "HOURLY", "RANDOM", "AUTO" */
/* DAILY, HOURLY show a new photo each day/hour                    */
/* RANDOM shows a new photo with each reload of the page           */
/* AUTO refreshes just the block with a new random photo      */
/*******************************************************************/
$selector = "AUTO";

/*******************************************************************/
/* Number of seconds between autorefresh of block, valid only for  */
/* $selector = AUTO                                                */
/*******************************************************************/
$auto_rate = 5;

/*******************************************************************/
/* Number of photos to display, valid only for $selector = RANDOM  */
/*******************************************************************/
$number_of_pix = 1;

/*******************************************************************/
/* Show photos horozontally(1) or vertically(0). Valid only for    */
/* $selector = RANDOM                                              */
/*******************************************************************/
$horozontal = 0;

/*******************************************************************/
/* Size of thumbnail. Leave at 0 to use Gallery default            */
/*******************************************************************/
$scaleTo = 0;

/*******************************************************************/
/* Scrolling photos, valid only for $selector = RANDOM             */
/*******************************************************************/
$scroll = 1;

/*******************************************************************/
/*          STOP!! DO NOT EDIT ANYTHING BELOW THIS POINT           */
/*******************************************************************/
define(CACHE_FILE, ALBUM_DIRECTORY."block-random.cache");


NG-RandomPhotoSelectTest_functions.php
Code: ›
/*******************************************************************/
/* Full path to your Gallery, don't forget the trailing /          */
/*******************************************************************/
$GALLERY_BASEDIR = "/var/www/whacked/modules/gallery/";

/*******************************************************************/
/* The module name of your Gallery, default is "gallery"           */
/*******************************************************************/
$GALLERY_MODULENAME = "gallery";

/*******************************************************************/
/* Time, in seconds, to refresh random photo cache. Default is     */
/* 86400 (check it daily)                                          */
/*******************************************************************/
define(CACHE_EXPIRED, 86400);

/*******************************************************************/
/* Full path to your albums directory, don't forget the trailing / */
/*******************************************************************/
define(ALBUM_DIRECTORY,"/var/www/whacked/albums/");



/*******************************************************************/
/*          STOP!! DO NOT EDIT ANYTHING BELOW THIS POINT           */



Anyone?

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
magikern
Joined: Jan 22, 2004
Posts: 19
Location: Oslo NO
Posted: Tue Mar 01, 2005 10:43 am
One small request:
GT-nextgen version! Didn't find one in the forum.

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
clipperpro
Joined: Jan 03, 2004
Posts: 1

Posted: Thu Mar 03, 2005 4:25 pm
I've read through the thread installed and then re-einstalled and I keep getting this error message:

Warning: main(NG-RandomPhoto_functions.php) [function.main]: failed to create stream: No such file or directory in /home/www/ataflightcrews/nuked/blocks/block-NG-RandomPhoto.php on line 30

Fatal error: main() [function.main]: Failed opening required 'NG-RandomPhoto_functions.php' (include_path='') in /home/www/ataflightcrews/nuked/blocks/block-NG-RandomPhoto.php on line 30

Can anyone help me out?

Thanks!

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
magikern
Joined: Jan 22, 2004
Posts: 19
Location: Oslo NO
Posted: Fri Mar 04, 2005 8:36 am
clipperpro wrote: › I've read through the thread installed and then re-einstalled and I keep getting this error message:

Warning: main(NG-RandomPhoto_functions.php) [function.main]: failed to create stream: No such file or directory in /home/www/ataflightcrews/nuked/blocks/block-NG-RandomPhoto.php on line 30

Fatal error: main() [function.main]: Failed opening required 'NG-RandomPhoto_functions.php' (include_path='') in /home/www/ataflightcrews/nuked/blocks/block-NG-RandomPhoto.php on line 30

Can anyone help me out?

Thanks!


just upload the file NG-RandomPhoto_functions.php to your blocks/ folder...

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
FNolan
Joined: Apr 29, 2005
Posts: 5

Posted: Mon May 02, 2005 1:19 pm
Hi, I've tried the isAlbumName to getAlbumName change. I still get this error which I got before the change . . .
"Fatal error: Call to undefined function: fs_file_exists() in /var/www/html/phpnuke/blocks/NG-RandomPhoto_functions.php on line 192"

Any thoughts or ideas would be appreciated.

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
drmike
Joined: Mar 20, 2005
Posts: 229
Location: Charlotte, NC
Posted: Mon May 02, 2005 7:01 pm
FNolan wrote: › Any thoughts or ideas would be appreciated.


Been discussed 8 times already on this board. A simple search for the error turns up the solution.

-drmike

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
FNolan
Joined: Apr 29, 2005
Posts: 5

Posted: Tue May 03, 2005 1:17 am
Took me awhile but I didfind it. Wasn'ta simple search tho, over 600 matches and only saw one that pertained to my error Smile

Thanks for the help tho, I entered the locations as http://sitename.com etc when it apparenly need a different syntax, /var/www/html/phpnuke. Seems to be working right now but only getting 2 images scrolling up. I'll play with the settings and see what I can get.

Again thanks for the help. Wink

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
drmike
Joined: Mar 20, 2005
Posts: 229
Location: Charlotte, NC
Posted: Tue May 03, 2005 9:56 am
FNolan wrote: › Took me awhile but I didfind it. Wasn'ta simple search tho, over 600 matches and only saw one that pertained to my error Smile


If you had dropped the error into the search and choosen "all words," you would have gotten 9 responces, 8 solutions and your thread.

-drmike

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
FNolan
Joined: Apr 29, 2005
Posts: 5

Posted: Wed May 04, 2005 11:31 am
Quote: › If you had dropped the error into the search and choosen "all words," you would have gotten 9 responces, 8 solutions and your thread.

-drmike


I did copy and paste the error into the search altho I didn't use exact match. If the search engine sorts by most relevent it should have put the ones with all the words first insted of 15-20 down the list, after some that only had 1 or 2 words that matched. Since this apparently isn't the case I know better now, I was going by most search engin parimeters.

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
Tolwyn
Joined: May 07, 2005
Posts: 23

Posted: Mon May 23, 2005 5:59 pm
Hey, you know... It's YOU that wanted to start nukedgallery.net.

Maybe you should start a guide on how to use a forum?

Search Nazi's piss me off.

drmike wrote: ›
FNolan wrote: › Took me awhile but I didfind it. Wasn'ta simple search tho, over 600 matches and only saw one that pertained to my error Smile


If you had dropped the error into the search and choosen "all words," you would have gotten 9 responces, 8 solutions and your thread.

-drmike

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Mon May 23, 2005 6:09 pm
no, drmike did not start nukedgallery.net, I did. Call me a "Search Nazi" if you will, however, this is primarily a one-man site. DrMike and Kit pitch in when they have time. In order to save myself time so that I might be able to address all the forum questions, I'm a strong advocate of "search, it's been asked before".

also, the "search first" rule is in the forum rules and regs [nukedgallery.net].

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
Tolwyn
Joined: May 07, 2005
Posts: 23

Posted: Tue May 24, 2005 12:08 pm
Sorry, dari.
Rotten mood yesterday. Didn't need to poop in this thread about it. Embarassed
I was just searching about 100 different forums yesterday and sometimes searches just don't work. When the person that knows the solution takes the time to post and simply says "search", then there is a self-defeating purpose, IMHO.

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
Tolwyn
Joined: May 07, 2005
Posts: 23

Posted: Tue May 24, 2005 12:09 pm
PS. No one reads the rules. Wink

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Tue May 24, 2005 12:15 pm
yeah yeah, and they were meant to be broken....

honestly though, if you had to answer the same question dozens of times over and over again, directing the user to a search, which they should do to begin with, saves everyone time. they get an immediate answer, instead of having to wait for you to step through and diagnose their problem, and you don't chew up time retyping what's already been said.

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
artificialhero
Joined: Jul 07, 2005
Posts: 3

Posted: Fri Jul 08, 2005 6:23 am
Hey all, I've been through this thread and done a search, I can't see any errors with this block, and I'm pretty sure I've set it up right, but when I enable the block the whole site disappears, apart from the left hand block column, which moves to the right, and the randomphoto block says "there's a problem right now with this block".

Anyone got any idea what's going on?

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Fri Jul 08, 2005 6:27 am
hmm...can you post the config lines from your block?

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
artificialhero
Joined: Jul 07, 2005
Posts: 3

Posted: Sat Jul 09, 2005 12:29 pm
block-NG-RandomPhoto.php:

Code: › <?php

/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or (at
 * your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * Developed by Dariush Molavi at NukedGallery.net
 * Version 2.0
 * 11 December 2003
 */

 if (eregi("block-NG-RandomPhoto.php",$_SERVER['PHP_SELF'])) {
    Header("Location: index.php");
    die();
}

global $gallery, $Version_Num;

require_once("NG-RandomPhoto_functions.php");

/*******************************************************************/
/* Valid values for $selector: "DAILY", "HOURLY", "RANDOM", "AUTO" */
/* DAILY, HOURLY show a new photo each day/hour                    */
/* RANDOM shows a new photo with each reload of the page           */
/* AUTO refreshes just the block with a new random photo      */
/*******************************************************************/
$selector = "RANDOM";

/*******************************************************************/
/* Number of seconds between autorefresh of block, valid only for  */
/* $selector = AUTO                                                */
/*******************************************************************/
$auto_rate = 5;

/*******************************************************************/
/* Number of photos to display, valid only for $selector = RANDOM  */
/*******************************************************************/
$number_of_pix = 3;

/*******************************************************************/
/* Show photos horozontally(1) or vertically(0). Valid only for    */
/* $selector = RANDOM                                              */
/*******************************************************************/
$horozontal = 0;

/*******************************************************************/
/* Size of thumbnail. Leave at 0 to use Gallery default            */
/*******************************************************************/
$scaleTo = 0;

/*******************************************************************/
/* Scrolling photos, valid only for $selector = RANDOM             */
/*******************************************************************/
$scroll = 1;


NG-RandomPhoto_functions.php:

Code: › <?php

/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or (at
 * your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * Developed by Dariush Molavi at NukedGallery.net
 * Version 2.0
 * 13 December 2003
 */

 if (eregi("block-NG-RandomPhoto_functions.php",$_SERVER['PHP_SELF'])) {
    Header("Location: index.php");
    die();
}

global $gallery, $GALLERY_EMBEDDED_INSIDE, $GALLERY_EMBEDDED_INSIDE_TYPE, $GALLERY_MODULENAME, $Version_Num;

/*******************************************************************/
/* Full path to your Gallery, don't forget the trailing /          */
/*******************************************************************/
$GALLERY_BASEDIR = "/home/public_html/NEW/modules/gallery/";

/*******************************************************************/
/* The module name of your Gallery, default is "gallery"           */
/*******************************************************************/
$GALLERY_MODULENAME = "gallery";

/*******************************************************************/
/* Time, in seconds, to refresh random photo cache. Default is     */
/* 86400 (check it daily)                                          */
/*******************************************************************/
define(CACHE_EXPIRED, 10);

/*******************************************************************/
/* Full path to your albums directory, don't forget the trailing / */
/*******************************************************************/
define(ALBUM_DIRECTORY,"/home/public_html/images/");



/*******************************************************************/
/*          STOP!! DO NOT EDIT ANYTHING BELOW THIS POINT           */
/*******************************************************************/
define(CACHE_FILE, ALBUM_DIRECTORY."block-random.cache");

$GALLERY_EMBEDDED_INSIDE = "nuke";
$GALLERY_EMBEDDED_INSIDE_TYPE = "phpnuke";

require_once($GALLERY_BASEDIR . "init.php");

function createBlockContent($album,$index,$scale,$auto=0) {
   global $gallery, $GALLERY_EMBEDDED_INSIDE, $GALLERY_EMBEDDED_INSIDE_TYPE, $GALLERY_MODULENAME;

   $id = $album->getPhotoId($index);
   $caption = $album->getCaption($index);
   $photo = $album->getPhoto($index);
   $dir = $album->getAlbumDirURL("full");
   $image = $photo->image;
   $PHOTO_URL = makeAlbumUrl($album->fields['name'], $id);
   $ALBUM_URL = makeAlbumUrl($album->fields['name']);
   if($scale == 0) {
                        if($auto == 0) {
                                $IMG = "<center><a href=\"$PHOTO_URL\">".$album->getThumbnailTag($index)."</a><br>";
                        }
                        else {
                                $IMG = "<center><a href=\"$PHOTO_URL\" target=\"_top\">".$album->getThumbnailTag($index)."</a><br>";
                        }
   } else {
                        if($auto == 0) {
                                $IMG = "<center><a href=\"$PHOTO_URL\">".$album->getThumbnailTag($index,$scale)."</a><br>";
                        }
                        else {
                                $IMG = "<center><a href=\"$PHOTO_URL\" target=\"_top\">".$album->getThumbnailTag($index,$scale)."</a><br>";
                        }
   }
   $FROM = "From: <a href=\"$ALBUM_URL\">" . $album->fields['title'] . '</a>';
   $blockContent .=  "\t$IMG\n";
   $blockContent .= "\t$caption<br />\n";
   $blockContent .= "\t$FROM\n</center>";
   return $blockContent;
}

function get_photo($interval, $scale,$auto=0) {
   global $gallery, $GALLERY_EMBEDDED_INSIDE, $GALLERY_EMBEDDED_INSIDE_TYPE, $GALLERY_MODULENAME;

   switch ($interval) {
      case 0:
         list($album,$index) = get_random_photo_id();
         while($album->getAlbumName($index)) {
            list($album,$index) = get_random_photo_id();
         }
         $blockContent = createBlockContent($album,$index,$scale,$auto);
         return $blockContent;
         break;
      case 1:
         if (file_exists($gallery->app->albumDir."/hourly.txt")) {
            $stat=stat($gallery->app->albumDir."/hourly.txt");
            $modtime = $stat['mtime'];
            if(date("G", $modtime) != date("G", time())) {            
               list($album,$index) = get_random_photo_id();
                              while($album->getAlbumName($index)) {
                                      list($album,$index) = get_random_photo_id();
                              }
               $blockContent = createBlockContent($album,$index,$scale);
               $fp = fopen($gallery->app->albumDir."/hourly.txt","w");
               fwrite($fp,$album->fields['name']."/".$index);
               fclose($fp);
               return $blockContent;
            }
            else {
               $fp = fopen($gallery->app->albumDir."/hourly.txt","r");
               $line = explode("/",fgets($fp));
               $albumName = $line[0];
               $album = new Album();
               $album->load($albumName);
               $index = $line[1];
               $blockContent = createBlockContent($album,$index,$scale);
               return $blockContent;
            }
         }
         else {
            list($album,$index) = get_random_photo_id();
                           while($album->getAlbumName($index)) {
                                   list($album,$index) = get_random_photo_id();
                           }
            $blockContent = createBlockContent($album,$index,$scale);
            $fp = fopen($gallery->app->albumDir."/hourly.txt","w");
            fwrite($fp,$album->fields['name']."/".$index);
            fclose($fp);
            return $blockContent;
         }
         break;
      case 24:
         if (file_exists($gallery->app->albumDir."/daily.txt")) {
            $stat=stat($gallery->app->albumDir."/daily.txt");
            $modtime = $stat['mtime'];
            if(date("d", $modtime) != date("d", time())) {            
               list($album,$index) = get_random_photo_id();
                              while($album->getAlbumName($index)) {
                                      list($album,$index) = get_random_photo_id();
                              }
               $blockContent = createBlockContent($album,$index,$scale);
               $fp = fopen($gallery->app->albumDir."/daily.txt","w");
               fwrite($fp,$album->fields['name']."/".$index);
               fclose($fp);
               return $blockContent;
            }
            else {
               $fp = fopen($gallery->app->albumDir."/daily.txt","r");
               $line = explode("/",fgets($fp));
               $albumName = $line[0];
               $album = new Album();
               $album->load($albumName);
               $index = $line[1];
               $blockContent = createBlockContent($album,$index,$scale);
               return $blockContent;
            }
         }
         else {
            list($album,$index) = get_random_photo_id();
                           while($album->getAlbumName($index)) {
                                   list($album,$index) = get_random_photo_id();
                           }
            $blockContent = createBlockContent($album,$index,$scale);
            $fp = fopen($gallery->app->albumDir."/daily.txt","w");
            fwrite($fp,$album->fields['name']."/".$index);
            fclose($fp);
            return $blockContent;
         }
         break;
   }
}

function get_random_photo_id(){
      /* Initializing the seed */
      srand ((double) microtime() * 1000000);

      // Check the cache file to see if it's up to date
      $rebuild = 0;
      if (fs_file_exists(CACHE_FILE)) {
         $stat = fs_stat(CACHE_FILE);
         $mtime = $stat[9];
         if ((time() - $mtime) > CACHE_EXPIRED) {
            $rebuild = 1;
         }
      }
      else {
         $rebuild = 1;
      }

      if ($rebuild) {
         scanalbums();
         savecache();
      }
      else {
         readcache();
      }

      $album = choosealbum();

      if ($album) {
         $index = choosephoto($album);
      }
      return array($album,$index);
}

function savecache() {
    global $cache;
    $fd = fopen(CACHE_FILE, "w");
    foreach ($cache as $key => $val) {
   fwrite($fd, "$key/$val\n");
    }
    fclose($fd);
}

function readcache() {
    global $cache;
    if ($fd = fs_fopen(CACHE_FILE, "r")) {
      while ($line = fgets($fd, 4096)) {
         list($key, $val) = explode("/", $line);
         $cache[$key] = $val;
      }
      fclose($fd);
    }
}

function choosephoto($album) {
    global $cache, $gallery;

    $count = $cache[$album->fields["name"]];

    if ($count == 0) {
      // Shouldn't happen
      return null;
    } else if ($count == 1) {
      $choose = 1;
    } else {
      $count = floatval($count);
      $choose = rand(1, $count);
      $wrap = 0;
      if ($album->isHidden($choose)) {
         $choose++;
         if ($choose > $album->numPhotos(1)) {
            $choose = 1;
            $wrap++;
            if ($wrap = 2) {
               return null;
            }
         }
      }
    }
    return $choose;
}

function choosealbum() {
    global $cache;

    /*
     * The odds that an album will be selected is proportional
     * to the number of (visible) items in the album.
     */

    $total = 0;
    foreach ($cache as $name => $count) {
      if (!$choose) {
         $choose = $name;
      }

      $total += $count;
      if ($total != 0 && ($total == 1 || rand(1, $total) <= $count)) {
         $choose = $name;
      }
    }

    if ($choose) {
      $album = new Album();
      $album->load($choose);
      return $album;
    } else {
      return null;
    }
}

function scanalbums() {
    global $cache;
    global $gallery;

    $cache = array();
    $everybody = $gallery->userDB->getEverybody();
    $albumDB = new AlbumDB();
    foreach ($albumDB->albumList as $tmpAlbum) {
      if ($everybody->canReadAlbum($tmpAlbum)) {
         $seeHidden = $everybody->canWriteToAlbum($tmpAlbum);
         $numPhotos = $tmpAlbum->numPhotos($seeHidden);
         $name = $tmpAlbum->fields["name"];
         if ($numPhotos > 0) {
            $cache[$name] = $numPhotos;
         }
      }
    }
}

?>


Thanks in advance,

ArtificialHero

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Mon Jul 11, 2005 8:09 am
perhaps you need the "NEW" in your album path?

also, if you're on a virtual server (ie, from a hosting company), sometimes they "mask" the true paths to the files. create a phpinfo file and see what the path is that it reveals as the "script path".

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
artificialhero
Joined: Jul 07, 2005
Posts: 3

Posted: Mon Jul 11, 2005 3:04 pm
That was it! Finding the script path and using that sorted it! thanks very much

artificialhero

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
mykroft
Joined: Sep 18, 2005
Posts: 4

Posted: Sun Sep 18, 2005 2:01 am
Ok, I am not new to gallery or php-nuke but.....

Am trying to get the block working correctly. Have made a test block as the last block on the right side.

Everything displays until I get to that block. No error msgs, and no page footer. It just stops. There is nothing even in display source .. last line is a <br> and then the next block should start.

Any ideas where to start. I have tripple checks the paths in the function file...

Thanks
Myk

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
mykroft
Joined: Sep 18, 2005
Posts: 4

Posted: Sun Sep 18, 2005 2:07 am
Ok, I should have checked the paths a 4th time Sad

Got that part correct but now....

The block shows up but is a black square where the pic should be.

Here is what is showing in the view source:

Code: ›
</head>
<TABLE WIDTH="181" BORDER="0" CELLPADDING="0" CELLSPACING="0">
  <TR>
    <TD width="181" height="26" class="right1">test</TD>
  </TR>
  <TR>
    <TD width="181" valign="top" class="right2"><center><iframe name="randomblock" scrolling="no" allowtransparency="true" width="140" src="block-NG-AutoPhoto.php?rate=5" frameborder="0" marginheight="0" marginwidth="0" hspace="0" vspace="0"></iframe></center></TD>
  </TR>
  <TR>
    <TD><IMG SRC="themes/alliancefull/images/alliancefull_33.jpg" WIDTH=181 HEIGHT=3 ALT=""></TD>
  </TR>
</TABLE>
<br></head>
<TABLE WIDTH="181" BORDER="0" CELLPADDING="0" CELLSPACING="0">
  <TR>
    <TD width="181" height="26" class="right1">Old Articles</TD>
  </TR>
  <TR>
    <TD width="181" valign="top" class="right2"><center>There isn't content right now for this block.</center></TD>
  </TR>
  <TR>
    <TD><IMG SRC="themes/alliancefull/images/alliancefull_33.jpg" WIDTH=181 HEIGHT=3 ALT=""></TD>
  </TR>
</TABLE>


I do not know where that first </head> is comming from....

Suggestions?

Thanks
Myk

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
mykroft
Joined: Sep 18, 2005
Posts: 4

Posted: Sun Sep 18, 2005 2:25 am
Found it and got it working.

Sorry - need to use search better....

FYI - would cause alot less greef for everyone if the dist files where updated with the isAlbumName > getaAlbumName fix.....

Myk

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Tue Sep 20, 2005 6:40 am
mykroft -
agreed, will do as soon as i'm done my forum run this AM.

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
kachukuma
Joined: Sep 03, 2005
Posts: 1

Posted: Fri Nov 18, 2005 7:25 pm
trying to use it as a center block. screws up the right side blocks (they vanish)... and doesnt work itself either (does not show up). Only the left hand side blocks shop up, the center content and blocks show up except for this one... Sad

php v4.3.3 using phpnuke 7.8 with chatserv patched 3.1, gallery 1.5 ... Gallery's working like a charm otherwise.

PLEASE HELP!!!

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
BumontheRun
Joined: Nov 24, 2005
Posts: 1

Posted: Mon Nov 28, 2005 11:44 pm
kachukuma wrote: › trying to use it as a center block. screws up the right side blocks (they vanish)... and doesnt work itself either (does not show up). Only the left hand side blocks shop up, the center content and blocks show up except for this one... Sad

php v4.3.3 using phpnuke 7.8 with chatserv patched 3.1, gallery 1.5 ... Gallery's working like a charm otherwise.

PLEASE HELP!!!


I've got the same problem but with nuke 7.9 at PHP 4.3.11

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
DannD
Joined: Nov 10, 2005
Posts: 2

Posted: Tue Jan 24, 2006 12:29 pm
BumontheRun wrote: ›
kachukuma wrote: › trying to use it as a center block. screws up the right side blocks (they vanish)... and doesnt work itself either (does not show up). Only the left hand side blocks shop up, the center content and blocks show up except for this one... Sad

php v4.3.3 using phpnuke 7.8 with chatserv patched 3.1, gallery 1.5 ... Gallery's working like a charm otherwise.

PLEASE HELP!!!


I've got the same problem but with nuke 7.9 at PHP 4.3.11


got the same problem, everything after where the block should be is missing aswell as the block.

AuthorMessage
Post Title: Re: [RELEASE] Random Photo V2
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Wed Jan 25, 2006 9:21 am
did you double check to make sure that the isalbumname / getalbumname switch is in your code?

All times are GMT - 5 Hours
Powered by PHPNuke and phpBB2 © 2006 phpBB Group