Welcome to Geeklog, Anonymous Thursday, March 28 2024 @ 11:56 am EDT

Geeklog Forums

New - Gallery Random Photo Block

Page navigation


Status: offline

efarmboy

Forum User
Moderator
Registered: 02/26/02
Posts: 147
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 or at squatty.com

    Enjoy,
    Blaine

  •  Quote

    Anonymous

    Anonymous
    Doesnt work for me Frown..now anywhere i go on my gl site it shows me a blank page...
     Quote

    Anonymous

    Anonymous
    How about a photo ratings system to allow the people to vote on their favorites?
     Quote

    Status: offline

    broelling

    Forum User
    Junior
    Registered: 04/30/02
    Posts: 23
    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...
    I'd rather be good than clever - I'd rather have all facts wrong, than no reply whatever...
     Quote

    Status: offline

    efarmboy

    Forum User
    Moderator
    Registered: 02/26/02
    Posts: 147
    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
     Quote

    Anonymous

    Anonymous
    if i remove the function from lib-common everything is OK..but while it's there it doesnt work...
     Quote

    Status: offline

    efarmboy

    Forum User
    Moderator
    Registered: 02/26/02
    Posts: 147
    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
     Quote

    Status: offline

    broelling

    Forum User
    Junior
    Registered: 04/30/02
    Posts: 23
    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
    I'd rather be good than clever - I'd rather have all facts wrong, than no reply whatever...
     Quote

    Anonymous

    Anonymous
    if i remove the function from lib-common everything is OK..but while it's there it doesnt work...
     Quote

    Status: offline

    efarmboy

    Forum User
    Moderator
    Registered: 02/26/02
    Posts: 147
    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
     Quote

    Status: offline

    efarmboy

    Forum User
    Moderator
    Registered: 02/26/02
    Posts: 147
    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
     Quote

    Status: offline

    broelling

    Forum User
    Junior
    Registered: 04/30/02
    Posts: 23
    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 Smile
    I'd rather be good than clever - I'd rather have all facts wrong, than no reply whatever...
     Quote

    Status: offline

    efarmboy

    Forum User
    Moderator
    Registered: 02/26/02
    Posts: 147
    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
     Quote

    ken

    Anonymous
    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.
     Quote

    ken

    Anonymous
    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.
     Quote

    Status: offline

    squatty

    Forum User
    Full Member
    Registered: 01/21/02
    Posts: 269
    Ken, I have the same exact issue as stated in you post. Please let me know what you come up with. Thnx, squatty
    In a world without walls and fences, who needs Windows and Gates?
     Quote

    Status: offline

    broelling

    Forum User
    Junior
    Registered: 04/30/02
    Posts: 23
    Still get the same errors, as I described last, when using the 1.01 version.
    I'd rather be good than clever - I'd rather have all facts wrong, than no reply whatever...
     Quote

    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)).
     Quote

    Status: offline

    squatty

    Forum User
    Full Member
    Registered: 01/21/02
    Posts: 269
    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?
    In a world without walls and fences, who needs Windows and Gates?
     Quote

    winnits

    Anonymous
    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
     Quote

    Page navigation

    All times are EDT. The time is now 11:56 am.

    • Normal Topic
    • Sticky Topic
    • Locked Topic
    • New Post
    • Sticky Topic W/ New Post
    • Locked Topic W/ New Post
    •  View Anonymous Posts
    •  Able to post
    •  Filtered HTML Allowed
    •  Censored Content