Removing the caption from images

greypanda - August 15, 2008 - 18:41
Project:Couloir Slideshow
Version:6.x-1.5
Component:Documentation
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

In http://drupal.org/node/183897 it was explained that setting "Display :none;" in the css for the caption would remove it. Well, all it does in 6.x seems to be to remove the surrounding black box. The caption still shows up. And the answer to "How do I set the caption" was to do it in CSS.

All-in-all this is a good module, but the documentation really stinks. These types of options should be a lot easier to control.

#1

kmadel - August 26, 2008 - 17:45
Version:6.x-1.x-dev» 6.x-1.5

If you replace the function couloir_slideshow_block with the following code, then you will be able to configure whether or not the caption is displayed on a block by block basis (I really don't see why all of the settings weren't done this way):

function couloir_slideshow_block($op='list', $delta=0, $edit = array()) {

// listing of blocks, such as on the admin/block page
$block = array();
switch ($op){
case 'list':
for ($i=1; $i <= variable_get('couloir_slideshow_number', '1'); $i++) {
$blocks[$i]['info'] = t('Couloir Slideshow '.$i);
}
return $blocks;
case 'view': default:
// Set default path
//$imagepath = conf_path() . '/files/couloir_slideshow'.$delta;

$imageprepath= file_directory_path() . '/' . variable_get('couloir_slideshow_imagepath', 'couloir_slideshow');
$imagepath = $imageprepath.$delta;

$settings['wmax'] = variable_get('couloir_slideshow_wmax', '500');
$settings['hmax'] = variable_get('couloir_slideshow_hmax', '500');
$settings['number'] = variable_get('couloir_slideshow_number', '1');
$settings['imageprepath'] = variable_get('couloir_slideshow_imagepath', 'couloir_slideshow');
$settings['order'] = variable_get('couloir_slideshow_order', 'random');
$settings['autoplay'] = variable_get('couloir_slideshow_autoplay', '1');
$settings['autoplay_dur'] = variable_get('couloir_slideshow_autoplay_dur', '10000');

$imagearray = getImageArray($imagepath, $settings);
$slideheader = "\n";
$slideheader .= getHeader($imagearray, $imagepath , $settings) . "\n";
$slideheader .= "\n";

$caption = '';
if(!variable_get('couloir_slideshow_disable_caption_'.$delta, FALSE)){
$caption = '

     

';
}

$url = base_path().drupal_get_path('module', 'couloir_slideshow');
$html = '

Previous
View Photo
Next

'.$caption.'

//
';

if (count($imagearray) > 0) {

drupal_set_html_head($slideheader);

drupal_add_js(drupal_get_path('module', 'couloir_slideshow') .'/js/behaviour.js');
drupal_add_js(drupal_get_path('module', 'couloir_slideshow') .'/js/jquery.fxqueues-2.0.2.js');
drupal_add_js(drupal_get_path('module', 'couloir_slideshow') .'/js/couloir-slideshow.js');

drupal_add_css(drupal_get_path('module', 'couloir_slideshow') .'/css/couloir.css');

$block['subject'] = 'Slideshow';
$block['content'] = $html;
}
return $block;
case 'configure':
// If $op is "configure", we need to provide the administrator with a
// configuration form. The $delta parameter tells us which block is being
// configured. In this example, we'll allow the administrator to customize
// the text of the first block.
$form = array();

$form['couloir_slideshow_disable_caption'] = array(
'#type' => 'checkbox',
'#title' => t('Disable slide show caption block.'),
'#default_value' => variable_get('couloir_slideshow_disable_caption_'.$delta, 'FALSE')
);
return $form;
case 'save':
// If $op is "save", we need to save settings from the configuration form.
// Have Drupal save the string to the database.
variable_set('couloir_slideshow_disable_caption_'.$delta, $edit['couloir_slideshow_disable_caption']);
return;
}

} // end function couloir_slideshow_block

#2

ComputerWolf - August 26, 2008 - 21:41

The reason it wasn't done this way is due to the fact that the original module was not designed to allow more than 1 slideshow, so there was no need to have settings done in a block by block basis if there was only one block. I will take what you have done here and work on getting some block specific settings moved over. I appreciate the help in adding needed features.

#3

ComputerWolf - August 27, 2008 - 00:51

As of 6.x-1.6 the option is available to remove captions from slideshows individually. Also, based on previous comments, it also changes many settings into individual slideshow settings to make the slideshows easier to configure.

#4

kmadel - August 27, 2008 - 12:23

You rock! Talk about a quick turn around time. If I see any other ways to improve anything I will certainly share.

Thanks for all of your hard work.

 
 

Drupal is a registered trademark of Dries Buytaert.