I found the best Random Image Block for Gallery (PHP Nuke 6.

J-Mann

Joined: 2003-03-21
Posts: 90
Posted: Mon, 2003-04-07 19:21

I tried the random image block located here on this site. It didn't work too well, caused several other problems, took too much work, had errors, etc...

I'm sure other people know about this, but the gallery dev team might want to talk to this person or include this block on the Gallery site. It's at the phpnuke.org web site in the downloads section:

http://phpnuke.org/modules.php?name=Downloads&d_op=viewdownload&cid=40

This thing worked WITHOUT making another file that requires you to use an <?php include statement. All I had to do was modify my galleries BASEDIR and upload it into my blocks directory and it worked perfectly. You can view it at http://www.perfectcell.org

The only other thing I had to do was change the line:

."align='middle'"."/>"

to

.">"

because it caused the link to not work, I'm sure it was just formatted improperly but the align tag isn't really needed anyways.

There's just one thing I'd like to do with it. I would like the image link to include my nuke header (and sidebar). So that when the image is clicked on, it looks exactly as if they had clicked on the image thumbnail in the album. Does anyone know exactly how to do this?

Anyways, props to the guy that modified this. It works great.

J-

 
J-Mann

Joined: 2003-03-21
Posts: 90
Posted: Tue, 2003-04-08 02:39

I've edited the file so that it includes your PHP-Nuke theme, headers, sidebards, etc. When someone clicks on an image in the random photo block it will load the page exactly as if they clicked on the image in the gallery.

I uploaded it to my web site, you can download it directly from here:

http://www.perfectcell.org/Random_Photo_Block.zip

NO REGISTRATION REQUIRED

I also edited the readme file and included all required steps to get this thing to work.

You can view a sample of it at http://www.perfectcell.org

Enjoy!

 
dmolavi
dmolavi's picture

Joined: 2002-12-05
Posts: 573
Posted: Tue, 2003-04-08 12:48

this is the same code that has been at my site (www.yankeesinthesouth.org) since January 24, 2003, and has been posted here since 6 December 2002.

 
krazee

Joined: 2003-04-08
Posts: 5
Posted: Tue, 2003-04-08 16:04
Quote:
this is the same code that has been at my site (www.yankeesinthesouth.org) since January 24, 2003.

I don't know Yankeeinthesouth, but I do still see errors on your site in some browsers (Mac IE and Safari, not in Netscape and Camino) but not on perfectcell's website.

I installed this block, also the modification of session.php, and it works beautifully in every browser on my platform now.

I ABSOLUTELY LOVE the integrated linking, I wouldn't have used the block if it linked to the standalone gallery.

--
ONE MORE MOD-IDEA:

Does either of you fellas know if it would be possible to include the caption for those random images?
Not all images speak for themselves, that would really finish of this already nice addon.

 
dmolavi
dmolavi's picture

Joined: 2002-12-05
Posts: 573
Posted: Tue, 2003-04-08 17:29
Quote:
I don't know Yankeeinthesouth, but I do still see errors on your site in some browsers (Mac IE and Safari, not in Netscape and Camino) but not on perfectcell's website.

--
ONE MORE MOD-IDEA:

Does either of you fellas know if it would be possible to include the caption for those random images?
Not all images speak for themselves, that would really finish of this already nice addon.

yes, yankeesinthesouth used to have the registered user error (not showing up when i view as admin, just as a regular user; and note that this is not a random block error, but a gallery error in phpnuke 6.5: <!-- BBCode Start --><A HREF="http://gallery.menalto.com/modules.php?op=modload&amp;name=phpBB_14&amp;file=index&amp;action=viewtopic&amp;topic=4482&amp;6" TARGET="_blank">http://gallery.menalto.com/modules.php?op=modload&amp;name=phpBB_14&amp;file=index&amp;action=viewtopic&amp;topic=4482&amp;6</A><!-- BBCode End -->). it's been fixed using the code from the final post at that referenced topic (and this will be included in the random-block instructions at YiTS). however, my code does pull the caption of the picture and display it in the block. it has done that since day one.

 
J-Mann

Joined: 2003-03-21
Posts: 90
Posted: Tue, 2003-04-08 18:00

There is one other difference, and that is the fact that you don't have to use another file to use the include tag and have 2 files in 2 directories.

Everything that needs to be in the file that belongs in the gallery directory is in the actual block- file.

It just makes things a little easier.

The code can't be exactly the same as yours for another reason, I manually entered code that was not there before. The base code, however, came from the same source.

I'm glad it's working for others... now I have another problem to work out with other blocks that use any piece of gallery on the same page. See my post on fs_copy.

 
josephhand

Joined: 2003-01-01
Posts: 25
Posted: Thu, 2003-04-10 12:03

ok... got it working... it only took 3 months! :wink:

So one more question... if I wanted to display the same photo all day, rather than have it change every time the page is refreshed, how would I pull that off?

thanks in advance...

jh

 
dmolavi
dmolavi's picture

Joined: 2002-12-05
Posts: 573
Posted: Thu, 2003-04-10 12:33
Quote:
ok... got it working... it only took 3 months! :wink:

So one more question... if I wanted to display the same photo all day, rather than have it change every time the page is refreshed, how would I pull that off?

thanks in advance...

jh

what did you have to change? i recall our exchange about your problems, and am curious what you had to do.

as for the pic a day thing, i was wondering about that as well, rather than a pic of the moment thing. i haven't given it much thought, but it shouldn't be too much of a code tweak to get that to work.

 
josephhand

Joined: 2003-01-01
Posts: 25
Posted: Thu, 2003-04-10 12:58

I used the block mentioned in this string. I did not need to have the 2 files as your version required. Made the edits, and it worked on the first try.

Go Figure!

jh

 
nukestud
nukestud's picture

Joined: 2003-03-25
Posts: 114
Posted: Mon, 2003-04-14 02:57

This block mod http://www.perfectcell.org/Random_Photo_Block.zip completely killed my phpnuke version. Now I have no content in the middle, just the blocks on the left and that's it!

 
J-Mann

Joined: 2003-03-21
Posts: 90
Posted: Tue, 2003-04-15 07:12

You should read the readme file included in the zip and make the appropriate changes to the block-Random_Photo.php file. There's only a few of them, but they are important.

Also, make sure the block is on the RIGHT side. It won't work on the left side on pages that have ANY part of gallery. You'll get errors and no content. Until someone comes up with a real fix for the fs_ function redeclare error, that's just what we have to do.

 
nukestud
nukestud's picture

Joined: 2003-03-25
Posts: 114
Posted: Tue, 2003-04-15 13:43

Yeah adding it to right side fixed it!

Thanks for answering!

 
EuroMagic
EuroMagic's picture

Joined: 2003-02-22
Posts: 7
Posted: Tue, 2003-04-15 19:21

I can't get any of the blocks working!! The best I have got is a block that shows "No picture chosen" all the time.
Can anyone help ?

 
J-Mann

Joined: 2003-03-21
Posts: 90
Posted: Tue, 2003-04-15 19:47

If you're getting "No photo Chosen" then it's working. But you probably have your gallery directory not properly inserted in the block-Random_Photo.php file. Make sure you read the readme file. Also make sure that when you do $GALLERY_BASEDIR= that it points to your gallery directory with the following /. Like this:
$GALLERY_BASEDIR = "modules/GALLERY_DIRECTORY_NAME/";

Insert the name of your gallery direcotory (case senstive) where it says GALLERY_DIRECTORY_NAME.

Also make sure that the block-Random_Photo.php file is in your blocks directory.

 
EuroMagic
EuroMagic's picture

Joined: 2003-02-22
Posts: 7
Posted: Tue, 2003-04-15 21:13

Thanks for the help, but it still dos'nt work. Now I get this error

Quote:
Warning: Invalid argument supplied for foreach() in block-Random_Photo.php on line 151

I have read the readme-random_photo.txt and done all the things said. The error above I got from using the random block that should work from the block dir. only. But when I used the random block that needed to be both in block dir. and gallery dir. I got the "No photo chosen".

Any idea to this problem ?

It is strange... why can't I get such a simple block to work, when I can get the most complex Mods for phpbb to work!! ...hehe :roll: I am sure that it will be the most stupid thing that I have forgot to edit... I just can't see/find it :grin:

 
J-Mann

Joined: 2003-03-21
Posts: 90
Posted: Tue, 2003-04-15 22:04

Sounds like there's something that you didn't edit in your session.php file. In my readme there are the following instructions:

Open the sessions.php file that is located in your gallery directory and locate the following code (towards the top of the file):
if (!$gallery->register_globals) {
foreach($HTTP_SESSION_VARS as $key => $value) {
eval("$$key = &amp; $_HTTP_SESSION_VARS["$key"];");

and change it to:
if (!$gallery->register_globals) {
foreach($_SESSION as $key => $value) {
eval("$$key = &amp; $_SESSION["$key"];");

Did you do that exactly?

 
EuroMagic
EuroMagic's picture

Joined: 2003-02-22
Posts: 7
Posted: Wed, 2003-04-16 20:02

Sorry, but still no good.

This is from my session.php file.

Quote:
/* emulate register_globals for sessions */
if (!$gallery->register_globals) {
foreach($_SESSION as $key => $value) {
eval("$$key = &amp; $_SESSION["$key"];");
}
}

And this is from my block-Random_Photo.php file.

Quote:
$GALLERY_BASEDIR = "modules/Gallery/";

and

$albumURL = "http://www.mkl.as/";
$albumURL .= "modules.php?set_albumName=".$album->fields["name"];
$albumURL .= "&amp;id=".$id;
$albumURL .= "&amp;op=modload&amp;name=Gallery&amp;file=index&amp;include=view_photo.php";

Please tell me where there is something wrong :smile:

Btw. Running PhpNuke 6.5 and Gallery 1.3.4-cvs-b17

Secondly, if I try to use your "block-Last_Updates.php" together with your "block-Random_Photo.php" I get errors like this

Quote:
Cannot redeclare fs_copy() (previously declared in d:foxservwwwmklmodulesGalleryplatformfs_win32.php:22) in

But it works okay alone, well it shows "Updated" 5 times, nothing else!!

So.. if there is anything I can do to make the help easyer please say so :smile:

PS. And thanks for the help so fare.

EuroMagic

 
J-Mann

Joined: 2003-03-21
Posts: 90
Posted: Thu, 2003-04-17 04:00

Ok, where to start...

First, the readme include with both files explains that they will not work at the same time. Although the random block readme didn't state this until I updated it the other day. This is a known issue. I think I'm close to solving it, but it's gonna be a while before I get time to finish it.

Next, it sounds like your server may be using a new(er) version of php. Try changing ALL instances of $HTTP_*_VARS to simply _* (with no HTTP or _VARS).

And finally, are you sure your gallery is named "Gallery" and not "gallery"? If it is Gallery (with a capital), try deleting the last_updated.cache file that is in your albums directory and let the program make it again, sometimes it takes a while before it writes to the cache file. After you delete the file, give it a good 24 hours (shouldn't take that long) to do its thing. (DO THIS LAST).

Also, if you were using another random photo block before, you might want to delte the cache file for that too.

Hope you get it working.

 
EuroMagic
EuroMagic's picture

Joined: 2003-02-22
Posts: 7
Posted: Tue, 2003-04-22 17:40

Still no good! I still get the same error, also with the above changes!

Quote:
Warning: Invalid argument supplied for foreach() in d:foxservwwwmklblocksblock-Random_Photo.php on line 151

My system is.
Apache 1.3.27
PHP 4.3.1
MySQL 3.23.56
PHPnuke 6.5
Gallery 1.3.4-cvs-b21 (witch work with PHPnuke 6.5 now )

 
J-Mann

Joined: 2003-03-21
Posts: 90
Posted: Tue, 2003-04-22 17:45

can you email me both blocks? The random photo and the last updates? I'll take a look at them when i get home from work tonight.

 
EuroMagic
EuroMagic's picture

Joined: 2003-02-22
Posts: 7
Posted: Tue, 2003-04-22 22:37

Done.

 
J-Mann

Joined: 2003-03-21
Posts: 90
Posted: Wed, 2003-04-23 03:47

I made many changes that you missed in the last updates block file and sent it back to you. But I noticed in BOTH files, you didn't change ANY of the $HTTP_XXX_VARS like I said in my last post. If the changes I made to the last updates file still will not allow you to use both files. Or if you get the same error when trying to use your random photo block without the last updates block. Try changing the following in BOTH files:

Change:
if (!empty($HTTP_GET_VARS["GALLERY_BASEDIR"]) ||
!empty($HTTP_POST_VARS["GALLERY_BASEDIR"]) ||
!empty($HTTP_COOKIE_VARS["GALLERY_BASEDIR"])) {

to:
if (!empty($_GET["GALLERY_BASEDIR"]) ||
!empty($_POST["GALLERY_BASEDIR"]) ||
!empty($_COOKIE["GALLERY_BASEDIR"])) {

If this works, then you should use your windows search function to search for files containing the text of $HTTP_ and get rid of any and all instances of $HTTP and _VARS so that they all look like the above ($_GET for example) because you're using a version of php that does not need the extra $HTTP or _VARS.

 
EuroMagic
EuroMagic's picture

Joined: 2003-02-22
Posts: 7
Posted: Fri, 2003-04-25 16:50

Hey again!

Sad but true, it still dos'nt work.

I have change both files, but change them back because it did'nt make any differens if I used "if (!empty($HTTP_GET_VARS[GALLERY_BASEDIR"])" or "if (!empty($_GET[GALLERY_BASEDIR"])" only.

In the block-random_photo, it will _not_ write any cache file if I change the "/block-random.cache" to something like "www/mkl/albums/block-random.cache" or "/www/mkl/albums/block-random.cache" or any other way.
But the Last Updates block, will only make a cache file _if_ I use the complet path to the albums folder, like "d:/www/mkl/albums/last-updated.cache"
If any of the block files build a cache-file, they build them the same second I activate the block.

So right now I have a random_photo block the shows "No photo chosen" and with an error above saying "Warning: Invalid argument supplied for foreach() in d:foxservwwwmklblocksblock-Random_Photo.php on line 151"
and a Last updates that says "Updated" 5 times, but don't show anything.
Installed the random block first and then the Last ipdates block. Also tryed to use the Last updates alone, no diffirents.

The only option I have not yet tryed, is to install a new phpnuke 6.5 site with only the gallery as a addon, maybe I will get time this weekend to give it a try.
So for now I'll wait a little with trying to get the block working on my current site.

Thanks again for the help.

 
razorweb

Joined: 2003-03-26
Posts: 2
Posted: Tue, 2003-05-13 02:44

I've been having the EXACT same problem as Euromagic. Running PHPNUKE 6.0 with 1.33.b15. I also tried removing the HTTP parts of those lines, but with no luck. any advice?

 
Riasah

Joined: 2003-05-23
Posts: 2
Posted: Fri, 2003-05-23 05:53

I am having the exact same error as Euro and have edited everything mentioned previously in this post and others.

Does anyone know where I could get the fix for this, I am currently using PHP-Nuke v.6.5 and Gallery v. 1.3.4-cvs-34

Have tried all of the tips and hints listed on this forum but am still getting the following warning message:

Quote:
Warning: Invalid argument supplied for foreach() in /home/mywebsitefileshere/html/blocks/block-Random_Photo.php on line 151

Any help in this matter would be so greatly appreciated :D

 
Kane

Joined: 2003-05-23
Posts: 2
Posted: Fri, 2003-05-23 06:10

K after trying all day to get registered to get the other file because it had the caption added I got fed up. Anyways decided to just use this one and modify it to do what I wanted you can find the download here at http://www.ac2blackops.com It is in the download section and I promise that you will not have to register to get it.

On a side note:

I had the same problem with the picture showing up the first time but never showing up after that. I found that when I changed the name of my album on the admin screen from album01 to blackops, Random Photo couldn't find any pictures anymore. When I changed it back it started working again.

Best of Luck

Kane

 
casper

Joined: 2003-06-08
Posts: 4
Posted: Sun, 2003-06-08 16:08

Hi Kane,

Thanks! this works fine...but it just showed the pics in the highlighted album..all other nested album in the same album are ignored...

Any fix?
Casper

 
Kane

Joined: 2003-05-23
Posts: 2
Posted: Mon, 2003-06-09 07:06

Actually dunno just knew enough to get it to show the name and album name but Ill look into it.

 
graphicsguy

Joined: 2003-06-11
Posts: 7
Posted: Thu, 2003-06-12 08:38

Thanks to all who have posted in this thread, I am able to get the random block working, which is great. Alas, I have it in the right-hand column, which also displays next to Gallery, so it dies. Normally I can suppress the display of the right-hand column by placing $index = 0; in the index.php file, but that doesn't seem to work with Gallery. Is there some trick to having Gallery not display the right-hand column blocks?

Thanks in advance

Cosmo

 
aviceda

Joined: 2002-10-10
Posts: 54
Posted: Wed, 2003-06-18 10:33

:)
Hi All,
Thanks to Kane, I downloaded the 'blacktop' version of the Random-Photo-Block and for the first time in months got it to work!

Unfortunately the block doesn't appear to be 'clickable', any ideas?

Have a look at http://www.aviceda.org/phpnuke

Tom

 
nadegda

Joined: 2003-06-21
Posts: 1
Posted: Sat, 2003-06-21 19:25

Well, block works great for me. Except, I wanted to see if I could restrict it to one album, or, preferably, exclude one of the albums from it. Thing is I have some personal albums, which I would like to use for random block, and one album-portfolio of Anatomy teacher with bunch of pictures of his work. While it is fine with me some people don't appreciate a "great looking" anatomical structure prepared for teching first year med students:)

 
silverpath

Joined: 2003-07-18
Posts: 7
Posted: Sat, 2003-07-19 18:42

I have phpnuke5.5 so the changes in Session.php will not work. Well it the block works but when you click on the random image it will take you to the actual image. When you click back or home, error "page can not be displayed". It happens consistently and sometimes other modules can not be displayed either.

Fix is to change back the session.php to the original file.

http://www.jumpset.com

....