How to put image caption text in flash gallery

bouddidje@drupa... - December 13, 2007 - 11:32
Project:Flash gallery
Version:5.x-1.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:bouddidje@drupalfr.org
Status:needs review
Description

to put txt in the flash, i've changed the code
txt is ok and you can choose to put it or not,
but the color still doesn't work: it takes the color of caption and titles

It is better to copy this text and open it in a text editor to see changes
sorry to not put line number, but you can find it with the text before the change

<?php
// $Id: flash_gallery.module,v 1.1.2.2.2.5 2007/04/19 15:37:29 sime Exp $
//changes to put or not text body caption, by bouddidje

function flash_gallery_help($section) {
  switch (
$section) {
    case
'admin/modules#description':
      return
t('Allows displaying image galleries with Flash animation');
  }
}

///...////

function flash_gallery_xml($tid = 0) {
 
$tid = (int) $tid;
 
$xml = <?xml version="1.0" encoding="UTF-8"?>
'."\n";
  $xml = "<simpleviewerGallery ". flash_gallery_xml_options($tid) .">\n";
  $result = db_query(db_rewrite_sql("SELECT n.nid FROM {term_node} t INNER JOIN {node} n ON t.nid=n.nid WHERE n.status=1 AND n.type='image' AND t.tid=%d ORDER BY n.sticky DESC, n.created DESC"), $tid);
  while ($nid = db_fetch_object($result)) {
$node = node_load($nid);
    $images = $node->images;
    if (flash_gallery_is_jpg(file_create_path($images['preview']))) {
      $xml .= '<image><filename>';
      $xml .= basename($images['preview']);
      $xml .= '</filename><caption><![CDATA[';
      if (variable_get('xml_display_title', 1)) {
$caption[] = $node->title;
      }
//to put caption of image (=body) (instead of
      //if (variable_get('xml_display_body', 1)) {
       // $caption[] = " $node->body;
     // } put this (choose the size here)
      if (variable_get('xml_display_body', 1)) {
        $caption[] = " \n<font size='11px'>".$node->body."</font>";
      }
//end work well
      if (variable_get('xml_show_link', 0)) {
        $caption[] = '<u>'. l(t('download'), file_create_url($images['_original'])) .'</u>';
      }
      if ($caption) {
        $xml .= implode(' :: ', $caption);
        unset($caption);
      }
      $xml .= ']]></caption></image>'."\n";

    }
  }
  $xml .= '</simpleviewerGallery>';
  drupal_set_header('Content-type: text/xml');
  print $xml;
  exit;
}

function flash_gallery_xml_options($tid) {
  $gallery = taxonomy_get_term($tid);
  $op[] = 'maxImageWidth="'. variable_get('xml_max_width', 480) .'"';
  $op[] = 'maxImageHeight="'. variable_get('xml_max_height', 480) .'"';
  $op[] = 'textColor="0x'. variable_get('xml_text_color', '5f5f5f') .'"';
//choose color of body:put this:
  $op[] = 'bodyColor="0x'. variable_get('xml_body_color', '5f5f5f') .'"';
//end: DON'T WORK
  $op[] = 'frameColor="0x'. variable_get('xml_frame_color', 'ffffff').'"';
  $op[] = 'frameWidth="'. variable_get('xml_frame_width', 20) .'"';
  $op[] = 'stagePadding="'. variable_get('xml_stage_padding', 40).'"';
  $op[] = 'thumbnailColumns="'. variable_get('xml_thumb_columns', 4) .'"';
  $op[] = 'thumbnailRows="'. variable_get('xml_thumb_rows', 1) .'"';
  $op[] = 'navPosition="'. variable_get('xml_nav_position', 'top').'"';
  $title = variable_get('xml_display_album', 1) ? $gallery->name : '';
  $op[] = 'title="'. $title .'"';
  $rc = variable_get('xml_right_click', 1) ? 'true' : 'false';
  $op[] = 'enableRightClickOpen="'. $rc .'"';
  //todo implement setting for background image
  $op[] = 'backgroundImagePath=""';
  $op[] = 'imagePath="'. flash_gallery_image_url() .'/"';
  $op[] = 'thumbPath="'. flash_gallery_image_url() .'/flash/thumbs/"';  return implode(' ', $op);
}

//....//

$form['colors']['xml_text_color'] = array(
    '#type' => 'textfield',
    '#default_value' => variable_get('xml_text_color', 'ffffff'),
    '#size' => 6,
    '#maxlength' => 6,
    '#title' => t('text color'),
    '#description' => t('Color of title and caption text.'),
    '#required' => TRUE,
  );
//choose color of body:put this:
$form['colors']['xml_body_color'] = array(
    '#type' => 'textfield',
    '#default_value' => variable_get('xml_body_color', '5f5f5f'),
    '#size' => 6,
    '#maxlength' => 6,
    '#title' => t('body color'),
    '#description' => t('Couleur du body = légende.'),
    '#required' => TRUE,
  );
//end: DON'T WORK
  $form['colors']['xml_frame_color'] = array(
    '#type' => 'textfield',
    '#default_value' => variable_get('xml_frame_color', 'ffffff'),
    '#size' => 6,
    '#maxlength' => 6,
    '#title' => t('frame color'),
    '#description' => t('Color of image frame, navigation buttons (on top and hover buttons) and thumbnail frame.'),
    '#required' => TRUE,
  );

//...//

$form['miscellaneous']['xml_display_album'] = array(
    '#type' => 'checkbox',
    '#default_value' => variable_get('xml_display_album', 1),
    '#title' => t('display album name'),
    '#description' => t('Whether to display the album name in the flash animation.'),
  );
//to choose to put or not the body=image caption=> put this:
  $form['miscellaneous']['xml_display_body'] = array(
    '#type' => 'checkbox',
    '#default_value' => variable_get('xml_display_body', 1),
    '#title' => t('display body'),
    '#description' => t('Whether to display the body in the flash animation.'),
  );
//end; work well
  $form['miscellaneous']['xml_show_link'] = array(
    '#type' => 'checkbox',
    '#default_value' => variable_get('xml_show_link', 0),
    '#title' => t('display download link'),
    '#description' => t('Apart from the node title, also display a clickable link to allow downloading the originally uploaded image.'),
  );

//...//

  if (!file_check_directory($store_path, FILE_CREATE_DIRECTORY)) {
    return FALSE;
  }
  return TRUE;
}

#1

bouddidje@drupa... - December 13, 2007 - 11:39

the entire code is here for a cupple of days

#2

Griff1324 - December 21, 2007 - 01:19

Is it possible to move the text below the images? Some of my description text overlaps with the picture. An example can be seen here:

http://tandl.stangit.com/?q=fgallery/1

Click on the second image to see the text overlapping the image.

Thanks,

Chris

#3

bouddidje@drupa... - January 2, 2008 - 15:19

generally, text is put under thumbnails, so you have to put navigation with some thumbnails
if you want to see caption

#4

sime - April 2, 2008 - 00:00
Project:SWF Tools» Flash gallery
Version:5.x-1.x-dev» 5.x-1.x-dev
Component:Flash Gallery» Code

** Moving Flash Gallery issues to own queue **

#5

oscarrg78 - August 23, 2008 - 04:24

Do you have an idea why is not working for me?

When I copy and paste the code to the flash_gallery.module file and upload it to the website it goes blank.

Any missing step?

Thanks and cheers,

#6

oscarrg78 - August 23, 2008 - 04:29

Sorry about that,

I made the text visible by changing the color of the text too...

Cheers,

 
 

Drupal is a registered trademark of Dries Buytaert.