WordPress.org

Ready to get started?Download WordPress

Forums

Lazy Gallery Slideshow??? (24 posts)

  1. sfboarders
    Member
    Posted 8 years ago #

    I installed Lazy Gallery on my blog and it's pretty nice. I was reading thru the posts and someone said that you can make a flash slideshow with it? If so, I can't find this setting or plugin. Anyone know where it is? If it's a separate application is there a gallery that has albums, thumbnails, fullsize and a slideshow that is fully intergrated into wordpress? TIA. :)

  2. akela
    Member
    Posted 8 years ago #

    I made a Dynamic Slideshow function for Lazyest gallery.
    It is NOT a plugin ! I wrote a function and put it inside Lazyest-gallery.php file. Call to this function from any place in sidebar.php gives you dynamic slideshow with preloaded thumbs of pictures with nice fading effect.
    look at http://www.mamboat.com

  3. jwurster
    Member
    Posted 8 years ago #

    Can you please provide a link to the javascript code?
    Thanks, jim

  4. VaamYob
    Member
    Posted 8 years ago #

    Not exactly a slideshow, but I've written a Lazy Gallery plugin EXTENSION that will allow you to randomly cycle through your images (with a nice fade effect also).
    With this plugin enhancement, you are not limited to viewing this in your gallery. You can put the random slideshow anywhere (even in a post).

    http://www.xyooj.com

  5. jwurster
    Member
    Posted 8 years ago #

    Vaam Yob: That looks really nice. Would you share the code? I see that you have also done some other interesting image coding.
    Thank you, jim

  6. VaamYob
    Member
    Posted 8 years ago #

    How comfortable are you with php ?
    You need to paste one method to plugins/lazy-gallery.php and maybe 2-3 functions to plugins/lazy-gallery/lazy-img.php

    Once you've done that, you put getRandomLazyImage(1, 1) anywhere in your theme/post/page that you want a random image. The first parameter is 1/0 wether or not you want a thumbnail/full image. The second parameter is 1/0 wether or not you want it to auto-reload with a new image every random X seconds.

    Let me know if you're comfortable pasting/modifying those functions/file.

  7. jwurster
    Member
    Posted 8 years ago #

    I am comfortable modifying files. So please include the code snippets that need to be added here or email to me at jwurster at comcast dot net.

    I appreciate your help. Thanks and Happy New Year.

  8. VaamYob
    Member
    Posted 8 years ago #

    In plugins/lazy-gallery/lazy-img.php, replace the initial call to generateImg with this code:

    if ($_GET['random']) {
    $files=array();
    get_dir_contents($files, $gallery_root);
    foreach ($files as $file) {
    //echo $file.'<br/>';
    }
    generateImg($files[array_rand($files)], $_GET['thumb']);
    } else {
    generateImg($gallery_root.$_GET['file'], $_GET['thumb']);
    }
    function get_dir_contents(&$files, $dirname) {
    $handle=opendir($dirname);
    while ($file = readdir($handle)) {
    if($file=='.'||$file=='..') {
    continue;
    }
    $full_name = $dirname.'/'.$file;
    if(is_dir($full_name) && !in_array($file, get_option("lg_excluded_folders")) ) {
    get_dir_contents($files, $full_name);
    } else {
    if (is_image(pathinfo($full_name))) {
    $files[]=$full_name;
    }
    }
    }
    closedir($handle);
    }

    function is_image($file_info) {

    switch(strtolower($file_info["extension"])) {
    case "jpeg":
    case "jpg":
    case "gif":
    case "png":
    return true;
    default:
    return false;
    }
    }

    Then in plugins/lazy-gallery.php put:

    function getRandomLazyImage($thumb = 1, $rotate = 0) {
    $src = get_settings('siteurl').'/wp-content/plugins/lazy-gallery/lazy-img.php?random=1&thumb='.$thumb;
    srand((double)microtime()*1000000);
    $randSuffix = rand(0,100);
    $imgHTML = '<div class="img-shadow" id="divRandomLazyImage'.$randSuffix.'"><img id="randomLazyImage'.$randSuffix.'" src="'.$src.'" /></div>';
    if ($rotate == 1) {
    $imgHTML = $imgHTML.' <script type="text/javascript">function refreshLazyImage'.$randSuffix.'() { var rnd = Math.random()*100; document.getElementById('randomLazyImage'.$randSuffix.'').src="'.$src.'&joe="+rnd; blendimage('divRandomLazyImage'.$randSuffix.'', 'randomLazyImage'.$randSuffix.'', ''.$src.''+rnd, 2500); window.setTimeout(refreshLazyImage'.$randSuffix.', Math.random()*5000+3000);} refreshLazyImage'.$randSuffix.'();</script>';
    }
    return $imgHTML;
    }

    Then add
    <script src="/your_web_path/wp-content/shared/fader.js" type="text/javascript"></script> to your theme's index.php
    You can get the file here:

    http://www.xyooj.com/blog/wp-content/shared/fader.js.txt

    Finally, put getRandomLazyImage(1, 1) anywhere you want the random image to go (you can call it more than once to have more than one random image displayed).

    Again, the first parameter value of 1 indicates that you want a thumbnail instead of a larger image. The second 1 indicates that you want it to automatically load a new random image.

    Happy blogging.

  9. jwurster
    Member
    Posted 8 years ago #

    Thanks. However, I just realized that I am using lazyest-gallery. You are using the lazy-gallery version. Should it work? I'm trying but I get a "parse error, unexpected T_STRING in lazyest-gallery.php at line 1032". This is where it's loadin $imgHTML = $imgHTML.' and so on.

  10. VaamYob
    Member
    Posted 8 years ago #

    Those are probably some syntax errors because of bbpress wrapping the code.

    $imgHTML = $imgHTML.' <script type="text/javascript">function refreshLazyImage'.$randSuffix.'() { var rnd = Math.random()*100; document.getElementById('randomLazyImage'.$randSuffix.'').src="'.$src.'&joe="+rnd; blendimage('divRandomLazyImage'.$randSuffix.'', 'randomLazyImage'.$randSuffix.'', ''.$src.''+rnd, 2500); window.setTimeout(refreshLazyImage'.$randSuffix.', Math.random()*5000+3000);} refreshLazyImage'.$randSuffix.'();</script>';

    Is all on one line.

  11. jwurster
    Member
    Posted 8 years ago #

    Yes, everything is on one line. I'll check it again.

  12. VaamYob
    Member
    Posted 8 years ago #

    OK, I figured it out.

    bbpress is un-escaping some escaped single quotes.

    I'll post a link to the file.

  13. VaamYob
    Member
    Posted 8 years ago #

    http://www.xyooj.com/blog/wp-content/shared/lazy-gallery.php.txt is what should be added to plugins/lazy-gallery.php

    http://www.xyooj.com/blog/wp-content/shared/lazy-img.php.txt
    is what should be added to plugins/lazy-gallery/lazy-img.php

  14. jwurster
    Member
    Posted 8 years ago #

    Thanks. No errors now, but also, no image. Does the javascript have to go in the index.php? Where should it be placed in that file?

  15. VaamYob
    Member
    Posted 8 years ago #

    the js is referenced by the index.php, not copy/pasted into there.

    In my case:

    <?php get_header(); ?>
    <script src="/blog/wp-content/shared/fader.js" type="text/javascript"></script>

  16. VaamYob
    Member
    Posted 8 years ago #

    Even if the js was invalid, there should still be an image...

    Because you're running lazyest-gallery, you need to change the line in the lazy(est)-gallery.php from:

    wp-content/plugins/lazy-gallery/lazy-img.php

    to something similar to:

    wp-content/plugins/lazyest-gallery/lazy-img.php

  17. jwurster
    Member
    Posted 8 years ago #

    Thanks, I forgot that. Still not working. It may be my theme. So, I'll try switching themes. Thanks again for your help.

  18. VaamYob
    Member
    Posted 8 years ago #

    Keep in mind, when you switch your theme, you need to re-add the reference to the js file and the function call.

    Do you have a url to where I can view what you've done ?

  19. jwurster
    Member
    Posted 8 years ago #

    My blog is http://www.jwurster.us/wordpress. I have the function call at the top of the left sidebar.

  20. VaamYob
    Member
    Posted 8 years ago #

    You seem to have an issue with your lazyest-img.php:

    http://www.jwurster.us/wordpress/wp-content/plugins/lazyest-gallery/lazyest-img.php?random=1&thumb=1

    The above link is supposed to return an image.

    Also, see:
    http://www.jwurster.us/wordpress/lazyest-index.php?file=Annabelle%202004-07-24/img_0016.jpg

    (lazyest-img.php may not be your ONLY problem)

  21. akela
    Member
    Posted 8 years ago #

    The Java script i used for SlideShow on my site http://mamboat.com i took from http://www.dynamicdrive.com
    They have some other cool scripts.

    Akela

  22. akela
    Member
    Posted 8 years ago #

    Also, I will prepare downloadable file with this function and instruction.

  23. jimatwork
    Member
    Posted 8 years ago #

    akela: Thanks, that would be very helpful for everyone.

    VaamYob: I did notice these problems. It seems I can display the thumbnails in the galleries, but when I click on the thumb, it takes me to just the link as you found without displaying the image. I guess it might have to do with permissions on the folders. I'll check this out.
    Thanks.

  24. jwurster
    Member
    Posted 8 years ago #

    VaaoYob: I've also been trying the built-in lg_random_image function with minimal success. If you check my blog, you'll see a random picture name, but no photo. Your function call is right above that one and still doesn't display.

    I thought they might conflict with each other and so deleted the lg_random_image code, but still nothing from your function. Now I have them both there.

    Still looking into file permissions.
    I really do appreciate your help.

Topic Closed

This topic has been closed to new replies.

About this Topic