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

funkeyrandy - May 31, 2007 - 17:02

i want to do this ...but all i get is a list of images....(the javascript files ARE being called however...)

thanks

#2

ardas - June 3, 2007 - 19:13

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

sliiiiiide - June 7, 2007 - 16:57

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

ardas - June 8, 2007 - 14:30

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

mancini - October 4, 2007 - 07:24
Category:feature request» support request

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

kkaefer - October 4, 2007 - 17:00
Category:support request» feature request

Please do not hijack completely unrelated threads.

#7

headkit - December 27, 2007 - 00:32

scriptfile is embeded correctly, id=slides is implemented but in firefox there is still shown a list of images...
:-(

#8

headkit - December 27, 2007 - 00:58

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

ardas - February 25, 2008 - 12:45

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.

AttachmentSize
slideshow_styles.zip 3.83 KB

#10

ardas - February 25, 2008 - 12:50
Status:active» needs review

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

dub4u - March 20, 2008 - 12:09

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

ardas - March 24, 2008 - 17:26

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

ardas - March 24, 2008 - 17:27

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

jo1ene - April 14, 2008 - 02:22

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

bappa.sarkar - April 15, 2008 - 07:29
Title:Fading autoplay slideshow» Problem in multiple slideshow in a single page

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

jo1ene - April 15, 2008 - 16:58
Title:Problem in multiple slideshow in a single page» Fading autoplay slideshow

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

ardas - April 15, 2008 - 19:57

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

ardas - April 15, 2008 - 20:03

bappa.sarkar, please create a separate thread for this issue.

#19

bappa.sarkar - April 17, 2008 - 08:35

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

ardas - May 4, 2008 - 06:41

Sorry, but what was the problem? What is the difference between "#slides" and "@id=slides"?

#21

SteelersMobileAdmin - May 4, 2009 - 23:28

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

tourtools - May 10, 2009 - 23:54

Hello, a question, when this feature will be committed in the current version or in a development version?

#23

unfeasible - September 30, 2009 - 02:40

Subscribe. Any patches for the slideshow fade for D6 in the works?

 
 

Drupal is a registered trademark of Dries Buytaert.