Posted on: 09/01/02 06:43pm
By: efarmboy
For Geeklog users that have implemented gallery as their photo management tool - this may be of interest.
The developer of Gallery (Bharat Mediratta) developed a RandomPhoto function and Nuke family portal block. This Random photo function has a number of features that will be of interest.
It uses the Gallery API and Gallery classes
It ignores empty albums
It caches the albums to improve speed
It only viewes public albums
Displays the photo caption in the block
Dispays the album name and link
I have integrated this function now as a Geeklog block function - requried some code to restructured, use geeklog display method and fix a session related problem. Also added a little bit of logic to not display image caption names that are default ones - like your photo ID.
I've archived up the files and instructions and they are available on my site here[*1] or at squatty.com[*2]
Enjoy,
Blaine
New - Gallery Random Photo Block
Posted on: 09/02/02 03:50pm
By: Anonymous (Anonymous)
Doesnt work for me
..now anywhere i go on my gl site it shows me a blank page...
New - Gallery Random Photo Block
Posted on: 09/02/02 04:22pm
By: Anonymous (Anonymous)
How about a photo ratings system to allow the people to vote on their favorites?
New - Gallery Random Photo Block
Posted on: 09/02/02 10:16pm
By: broelling
Well it's a great idea, but I can't seem to get it to work.
I get this error: Failed opening required 'errors/configure_instructions.php' (include_path='.:/usr/local/lib/php') in /usr/local/www/mypath/gallery/errors/unconfigured.php on line 10
I got the path right - it seems to have something to do with the CACHE function - I think. But I'm not sure...
New - Gallery Random Photo Block
Posted on: 09/03/02 08:50am
By: efarmboy
I would suggest you back it out and see if that clears up your problem. It would appear you may have added a blank line to the end of the lib-custom.php file - after the last ?>
If it still occurs even after removing the function you added in lib-custom.php, then it's something else.
Blaine
New - Gallery Random Photo Block
Posted on: 09/03/02 09:01am
By: Anonymous (Anonymous)
if i remove the function from lib-common everything is OK..but while it's there it doesnt work...
Re: Error
Posted on: 09/03/02 09:14am
By: efarmboy
I just did a fresh install + gallery integration and got the same error.
Gallery has a function called gallerySanityCheck in gallery/init.php that is checking if $GALLERY_BASEDIR is set. It is set in our lib-custom function and in fact gallery/init is able to resolve it but it's not being resolved inside the sanity function even though it's being identified as global.
I was able to solve it by adding a second define in the lib-custom function. Add this line and let me know if that works.
$GLOBALS['GALLERY_BASEDIR']= "/path/to/gallery/";
Blaine
New - Gallery Random Photo Block
Posted on: 09/03/02 09:25am
By: broelling
Well it works - for a second. After submitting the block, I see the block and no errors, but when I load the page or another page on the site, I get these errors:
Warning: rand() expects parameter 2 to be long, string given in /usr/local/www/broelling-dk/vejlerne/geek/public_html/block-random.php on line 70
ERROR: requested index [] out of bounds [10]
Fatal error: Call to a member function on a non-object in /usr/local/www/broelling-dk/vejlerne/gallery/classes/Album.php on line 570
New - Gallery Random Photo Block
Posted on: 09/03/02 09:53am
By: Anonymous (Anonymous)
if i remove the function from lib-common everything is OK..but while it's there it doesnt work...
New - Gallery Random Photo Block
Posted on: 09/03/02 10:58am
By: efarmboy
Hum.. I've not seen that. You may want to add some debugging output in the function to see where it's getting to b4 hanging. It may be in the gallery code. Try and see if you can echo out a test message b4 it does the include to gallery/init.php and then after.
Blaine
New - Gallery Random Photo Block
Posted on: 09/03/02 11:16am
By: efarmboy
Your right, I was getting an error but only when I access the my gallery photos. All the GL sections of the site were ok.
I was not getting the error you reported but an error from my block about not being able to open the block-random.cache file.
I also found an alternative to adding the GLOBALS['GALLERY_BASEDIR'] line, which is add the variable to the globals defined in the lib-custom function.
To resolve the error opening the cache file, I just coded the full path for the define of CACHE_FILE instead of using the $gallery->app->albumDir.
I found that albumDir was being set ok when I was on GL related pages but as soon as I went to gallery code, it was not being set.
Blaine
New - Gallery Random Photo Block
Posted on: 09/03/02 11:37am
By: broelling
So you solved it!??
I guess I don't understand much of what you wrote (read: My fault!), as I'm not very much into the scriptthing
Fair enough :)
Posted on: 09/03/02 02:59pm
By: efarmboy
I've updated the archive on my site with the change I was describing. Try replacing the phpblock function in lib-custom.php. There are now two variables that you need to set the path for - which are referenced in the updated install directions.
Thanks for your patience - I somehow did not see this on my site. I did after trying to install it on a second fresh site.
Let me know if this works for you.
Blaine
Not working for me either
Posted on: 09/03/02 06:57pm
By: Anonymous (ken)
Its not working for me either. I keep getting the "Gallery has not been configured" error message like you mentioned in another thread, but doing the $GLOBAL thing didn't fix it. The problem is in the if() statement when it checks $gallery->app... it is undefined. Stragely, every variable from the gallery config.php file is showing up as undefined, but it is definitely loading the config.php file. Going to hack it apart some more.
Not working for me either - Couple fixes
Posted on: 09/03/02 07:26pm
By: Anonymous (ken)
I fixed my initial problem by adding $gallery into the global defs at the start of phpblock_galleryRandomPhoto.
I also added $GALLERY_NO_SESSIONS to it. It kept trying to pull in and set sessions and nothing seemed to use that variable, so I edited init.php to not include sessions.php if that was set.
Also, I was getting tons of errors in my apache log file because it was trying to pull in Gallery's CSS files but was using the wrong path, so I edited util.php where it pulls them in and edited out all the ones where it was getting the standalone ones (was trying to do that since it still doesn't see all the vars from config.php).
I'm getting the rand() error message too, working on that.
Not working for me either
Posted on: 09/03/02 09:29pm
By: squatty
Ken,
I have the same exact issue as stated in you post. Please let me know what you come up with.
Thnx,
squatty
Fair enough :)
Posted on: 09/03/02 09:35pm
By: broelling
Still get the same errors, as I described last, when using the 1.01 version.
Number of fixes
Posted on: 09/03/02 11:17pm
By: Anonymous (Anonymous)
I'll post this here too, since it could help a number of other people. List of a couple fixes to common problems:
First, I was getting the "Gallery is not configured" error. Found out
that the config.php vars were not available to the function. Worked arround
by adding $gallery to the global def in phpblock_galleryRandomPhoto.
Second, was getting an error about trying to set sessions vars after stuff
was sent. Noticed that $GALLERY_NO_SESSIONS was not used anywhere, so I
added it to the global def too and edited Gallery's init.php to have an
if($GALLERY_NO_SESSIONS != true) { thing when it included it.
Third, was noticing in my error.log that the page was trying to add
Gallery's CSS files, but the path was wrong. Also, it gets the standalone
ones since it also doesn't see config.php vars. Edited out the lines in
getStyleSheetLink from util.php which get both embedded_style and
standalone_style.
Fourth, I was getting the problem with the rand() function. Quick fix was
to change it to rand(1, intval($count)).
New - Gallery Random Photo Block
Posted on: 09/04/02 05:57am
By: squatty
I'm now getting he following error:
Warning: Invalid argument supplied for foreach() in /usr/products/apache/htdocs/public_html/block-random.php on line 98
Does anyone else have this issue?
New - Gallery Random Photo Block
Posted on: 09/04/02 06:48am
By: Anonymous (winnits)
I had the same problem, I've given up for now as I currently don't have a Gallery integration in a development environment and didn't want to keep affecting my live site for too long...
--
Alan @ goddammit.co.uk
New - Gallery Random Photo Block
Posted on: 09/04/02 01:05pm
By: Anonymous (ken)
Try this[*3]
I think it is covered in the fourth one. You might have warnings turned off, so you don't see the warning about the rand() function. Look for this line just a little before line 98:
$choose = rand(1, $count);
And change it to:
$choose = rand(1, intval($count));
Hope that helps.
New - Gallery Random Photo Block
Posted on: 09/04/02 03:33pm
By: squatty
Still getting the same warning message both on the browser and in the Apache error.log:
Warning: Invalid argument supplied for foreach() in /usr/products/apache/htdocs/public_html/block-random.php on line 98
I have my php.ini error reporting set to error_reporting = E_ALL
I also made the update to the block-random.php file:
//$choose = rand(1, $count);
$choose = rand(1, intval($count));
The block displays "No photo chosen." Any other ideas?
New - Gallery Random Photo Block
Posted on: 09/04/02 09:29pm
By: Anonymous (ken)
Check the path to your albums... my guess is that the $count variable is null, so it can't do the foreach. That would also explain why your cache file is empty.
Broken with PHP 4.2.3 ?
Posted on: 09/09/02 12:50pm
By: 47ronin
I'm on Mac OS X Jaguar, using mySQL 3.23.51 and PHP 4.2.3 ... Geeklog version 1.3.5, Apache 1.3.26.. Everything worked fine with PHP 4.1.2, but with the upgrade to 4.2.3 the index.php page is broken with...
Warning: extract() expects first argument to be an array in /Volumes/Taki/Projects_Web/gallery/init.php on line 60
Warning: extract() expects first argument to be an array in /Volumes/Taki/Projects_Web/gallery/init.php on line 61
Warning: extract() expects first argument to be an array in /Volumes/Taki/Projects_Web/gallery/init.php on line 62
Warning: Invalid argument supplied for foreach() in /Volumes/Taki/Projects_Web/gallery/init.php on line 64
Warning: rand() expects parameter 2 to be long, string given in /Volumes/Taki/Projects_Web/geeklog/public_html/block-random.php on line 70
ERROR: requested index [] out of bounds [12]
Fatal error: Call to a member function on a non-object in /Volumes/Taki/Projects_Web/gallery/classes/Album.php on line 570
I'm not sure how to fix this for now except to manually disable the block. Any ideas? Fix for new PHP?