Fading autoplay slideshow
ardas - May 24, 2007 - 15:40
| Project: | Slideshow |
| Version: | HEAD |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Description
Greetings.
I'm using slideshow since Drupal 4.7 and found that there is no fading autoplay slideshow any more in 5.0 version. This is probably because you decided not to use 3d party javascripts which is right but lack of this functionality is a big loss.
We found a good jquery plugin (innerfade) to implement this and did the following:
1. Download innerfade.js from jquery site (it is very small, only 2.7K) and put it into slideshow directory.
2. Create one more extremely small slides.js:
$(document).ready( function(){
$('#slides').innerfade({
animationtype: 'fade',
speed: 'slow',
timeout: 2000,
type: 'random',
containerheight: '117px'
});
});3. Override theme_slideshow() function:
<?php
function phptemplate_slideshow($element) {
$slideshow = $element['#slideshow'];
$gallery = reset($slideshow['settings']);
$list = array();
$list[] = '<ul id="slides">';
foreach ($gallery['images'] as $i) {
$list[] = '<li><img class="image" src="'. $i['src'] .'" /></li>';
}
$list[] = '</ul>';
drupal_add_js(drupal_get_path('module', 'slideshow') .'/innerfade.js');
drupal_add_js(drupal_get_path('module', 'slideshow') .'/slides.js');
return implode("\r\n", $list);
}
and thats all! Autoplay fading slideshow is working!
I would like to propose you to include this feature into your module, add one more slideshow setting ("fading") if necessary and improve your theme function to detect slideshow mode.
Waiting for your feedback. Thanks!
?>
#1
i want to do this ...but all i get is a list of images....(the javascript files ARE being called however...)
thanks
#2
Are you sure javascript files were correctly included into result page? Please, review them by viewing page source.
If you have just a list of images this means javascript didn't processed it.
ul id="slides" is important!
be sure you put files into proper location.
#3
This modification works a treat! One more thing: I'd love to inlcude the slideshow image descriptions (as in the non-fading version). Would be grateful if someone could point me in the right direction - i'm pretty new to php...
#4
Patch phptemplate_slideshow() function and dump $element parameter - image titles should be there. If there are no image titles you should read them from database.
For module author ... It looks like a good feature and probably theme function should include image titles as well (ideally there should be a variable to toggle titles).
#5
Excuse me, why I have this errors when I submit the slideshow content:
warning: reset(): Passed variable is not an array or object in /var/www/html/modules/slideshow/slideshow.module on line 227.
warning: Invalid argument supplied for foreach() in /var/www/html/modules/slideshow/slideshow.module on line 231.
Would anyone help me? Thank you very much
#6
Please do not hijack completely unrelated threads.
#7
scriptfile is embeded correctly, id=slides is implemented but in firefox there is still shown a list of images...
:-(
#8
hm, i changed some settings in slides.js and then it worked. thats fine.
but containerheight: 'auto' does not work - and i need that!
also i want to add the functionality that there is shown the number of pictures and every image has its own link like "1 | 2 | 3 | 4" where a click stops the slideshow and shows the linked picture.
any solutions in that direction yet?
#9
Greetings,
I am providing a patch which implements slideshow style feature.
1. Original style called Manual Rotation now.
2. A new Auto Fading style is added and implements the feature discussed above.
3. theme_slideshow now calls either theme('slideshow_manual', ...) or theme('slideshow_auto_fading', ...) depending on style.
Attached archive consists of the following:
1. innerfade.js - jQuery plugin
2. slides.js - Initialization of innerfade (TODO: Customize settings on a node basis)
3. slideshow_install.patch - Patch for hook_install() to add a new style column and update_3() to alter existing table.
4. slideshow_module.patch - Patch to a module.
#10
forgot to change status...
Dear kkaefer, if you have any comments or thoughts regarding this patch please share them with me. We are interesting in supporting the module and helping to improve it.
#11
Against which slideshow version is this patch? I have problems applying it:
$ patch slideshow.install slideshow_install.patch(Stripping trailing CRs from patch.)
patching file slideshow.install
Hunk #1 succeeded at 99 (offset 64 lines).
Hunk #2 FAILED at 110.
Hunk #3 succeeded at 149 with fuzz 2 (offset 13 lines).
1 out of 3 hunks FAILED -- saving rejects to file slideshow.install.rej
slideshow.install.rej contains:
****************** 109,114 ****
vid integer NOT NULL DEFAULT 0,
location INTEGER NOT NULL,
align INTEGER NOT NULL,
dimensions varchar(20) NULL,
PRIMARY KEY (nid, vid)
)");
--- 110,116 ----
vid integer NOT NULL DEFAULT 0,
location INTEGER NOT NULL,
align INTEGER NOT NULL,
+ style INTEGER NOT NULL,
dimensions varchar(20) NULL,
PRIMARY KEY (nid, vid)
)");
I tried against slideshow 5.x-2.0-c and HEAD.
#12
I did it against development release which was available when I did the patch.
I made the patch file with Araxis Merge. Could it be a reason?
#13
From the provided source code I don't see any problems to apply the patch. The new line is "style INTEGER NOT NULL", all other code is the same.
#14
ARDAS - I emailed you about this, but I have been finding so many good messages in my spam box that I'm afraid your reply might be lost. Thank you for taking the time to add this feature! I was wondering what it would take ($) and/or are you available to do the same for this project:
http://drupal.org/project/cck_multimage
#15
I have use
1. Innerfade.js
2. slide.js
3. Override theme_slideshow()
I publish 2 slideshows in a single page. One slideshow is ok but the other one giving list of images.
#16
Please don't hijack this thread's title. This thread is about an autoplay feature. Feel free to submit your findings regarding this patch, but leave the issue title alone.
#17
jo1ene, it is impossible to estimate time needed to implement this feature in CCK Multimage module, I've never used it and at the moment I sent a request to this module's author regarding co-maintaining it. I hope I'll be able to provide some patches for this module. I'll contact you shortly when I have some response from him.
Thank you for your interest.
#18
bappa.sarkar, please create a separate thread for this issue.
#19
Hi ARDAS,
Thanx for your suggesion, But JavaScript always run in single thread. I give some time to fix the problem. I am new in JQuery. After learning some concept of JQuery I found the solution.
=========Solution is=========
Change in slides.js file. I change
$('#slides').innerfade({ -------> $("ul[@id=slides]").innerfade({
Now it is working fine.
#20
Sorry, but what was the problem? What is the difference between "#slides" and "@id=slides"?
#21
Hey guys, this is going to be a dumb question...i do have a good understanding of php, but i dont see what you guys are saying by "Override theme_slideshow()" Where are you referencing this at? should there be a 3rd separate php file or is it the slideshow.module?
the files i have under the slideshow directory are:
slideshow.js
slidshow.admin.inc
slideshow.info
slideshow.css
slideshow.module
innerfade.js
Sorry about this question, but i have spent a few hours and tried a bunch of different things but nothing works.
Thanks,
Oh and im using godaddy to host so i cant use the .install or the .patch
#22
Hello, a question, when this feature will be committed in the current version or in a development version?
#23
Subscribe. Any patches for the slideshow fade for D6 in the works?