Lazy Gallery Slideshow???
-
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. ??
-
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 https://www.mamboat.comCan you please provide a link to the javascript code?
Thanks, jimNot 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).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, jimHow comfortable are you with php ?
You need to paste one method toplugins/lazy-gallery.php
and maybe 2-3 functions toplugins/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.
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.
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:https://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.
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.
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.Yes, everything is on one line. I’ll check it again.
OK, I figured it out.
bbpress is un-escaping some escaped single quotes.
I’ll post a link to the file.
https://www.xyooj.com/blog/wp-content/shared/lazy-gallery.php.txt is what should be added to plugins/lazy-gallery.php
https://www.xyooj.com/blog/wp-content/shared/lazy-img.php.txt
is what should be added to plugins/lazy-gallery/lazy-img.phpThanks. 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?
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>
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
- The topic ‘Lazy Gallery Slideshow???’ is closed to new replies.