Topics

User Functions

Events

There are no upcoming events

What's New

Stories

1 new Stories in the last 2 weeks

Comments last 2 weeks

No new comments

Trackbacks last 2 weeks

No new trackback comments

Links last 2 weeks

No recent new links

NEW FILES last 14 days

No new files

Welcome to Geeklog Saturday, May 25 2013 @ 06:45 AM EDT


 Forum Index > Extensions > PHP Blocks New Topic Post Reply
 New - Gallery Random Photo Block
First | Previous | 1 2 | Next | Last
   
efarmboy
 09/01/02 06:43PM (Read 6621 times)  
+++++
Full Member

Status: offline


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


  •  
    Profile Email Website
     Quote
    Anonymous: Anonymous
     09/02/02 03:50PM  



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

     
     Quote
    Anonymous: Anonymous
     09/02/02 04:22PM  



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

     
     Quote
    broelling
     09/02/02 10:16PM  
    ++---
    Junior

    Status: offline


    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...
     
    Profile Email Website
     Quote
    efarmboy
     09/03/02 08:50AM  
    +++++
    Full Member

    Status: offline


    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

     
    Profile Email Website
     Quote
    Anonymous: Anonymous
     09/03/02 09:01AM  



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

     
     Quote
    efarmboy
     09/03/02 09:14AM  
    +++++
    Full Member

    Status: offline


    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

     
    Profile Email Website
     Quote
    broelling
     09/03/02 09:25AM  
    ++---
    Junior

    Status: offline


    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...
     
    Profile Email Website
     Quote
    Anonymous: Anonymous
     09/03/02 09:53AM  



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

     
     Quote
    efarmboy
     09/03/02 10:58AM  
    +++++
    Full Member

    Status: offline


    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

     
    Profile Email Website
     Quote
    efarmboy
     09/03/02 11:16AM  
    +++++
    Full Member

    Status: offline


    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

     
    Profile Email Website
     Quote
    broelling
     09/03/02 11:37AM  
    ++---
    Junior

    Status: offline


    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...
     
    Profile Email Website
     Quote
    efarmboy
     09/03/02 02:59PM  
    +++++
    Full Member

    Status: offline


    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

     
    Profile Email Website
     Quote
    ken
     09/03/02 06:57PM  
    +----
    Newbie

    Status: offline


    Registered: 07/17/02
    Posts: 12
    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.

     
    Profile Email Website
     Quote
    ken
     09/03/02 07:26PM  
    +----
    Newbie

    Status: offline


    Registered: 07/17/02
    Posts: 12
    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.

     
    Profile Email Website
     Quote
    squatty
     09/03/02 09:29PM  
    +++++
    Full Member

    Status: offline


    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?
     
    Profile Email Website
     Quote
    broelling
     09/03/02 09:35PM  
    ++---
    Junior

    Status: offline


    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...
     
    Profile Email Website
     Quote
    Anonymous: Anonymous
     09/03/02 11:17PM  



    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
    squatty
     09/04/02 05:57AM  
    +++++
    Full Member

    Status: offline


    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?
     
    Profile Email Website
     Quote
    winnits
     09/04/02 06:48AM  
    ++---
    Junior

    Status: offline


    Registered: 03/22/02
    Posts: 19
    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

     
    Profile Email Website
     Quote
    First | Previous | 1 2 | Next | Last
    Content generated in: 0.45 seconds
    New Topic Post Reply

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