Mery Xmas from Germany,
Today I wrote a present for you I changed the simpleviewer modul to get tiltviewer access

swf() syntax for PHP

$files = array('a.jpg', 'b.jpg', 'c.jpg', 'd.jpg', 'e.jpg', 'f.jpg');

	    print   swf($files, array(
	      'methods' => array(
	      'player' => 'tiltviewer',
	      'action' => 'swftools_image_display_list',
	      'swftools_player_path' => ''
	      ),
	      'flashvars' => array(
	      'useFlickr' => "",
	      'user_id' =>"",
	      'tags' =>"",
	      'tag_mode' =>"",
	      'linklabel' =>"view image info",
	      'langgofull' =>"view image info",
	      'langexitfull' => "view image info",
	      'langAbout' => "view image info",
	      'maxJPGSize' => 1200,
	      'bkgndInnerColor' => "0x333333",
	      'bkgndOuterColor' => "0xFFFFFF",
	      'backcolor' =>"0xFFFFff",
	      'textColor' => "0x181818",
	      'framecolor' =>"0xFFFFFF",
	      'usereloadbutton' =>"TRUE",
	      'showflipbutton' =>"TRUE",
	      'showlinkbutton' =>"TRUE",
	      'columns' => 5,
	      'rows' =>5,
	      ),
	      'params' => array(
	      'height' =>500,
	      'width' => 600,
	      ),
	      'othervars' => array(
	      'html_alt' => "html alt"
	      ),
	      ));

swf() syntax for HTML

[swf files="a.jpg&&b.jpg&&c.jpg"
methods="player=tiltviewer&&action=swftools_image_display_list"
flashvars="useFlickr=FALSE&&user_id=&&tags=&&tag_mode=&&linklabel=view image info&&langgofull=view image info&&langexitfull=view image inof&&langAbout=view image info&&maxJPGSize=1200&&bkgndInnerColor=0xFFFFFF&&bkgndOuterColor=0x000000&&backcolor=0xFFFFFF&&textColor=0xFFFFFF&&framecolor=0xFFFFFF&&usereloadbutton=TRUE&&showflipbutton=TRUE&&showlinkbutton=TRUE&&columns=3&&rows=3"]

or use Flickr to display your pictures

use one image file to initialize tiltviewer with swftools

swf() syntax for HTML

[swf files="a.jpg"
methods="player=tiltviewer&&action=swftools_image_display_list"
flashvars="useFlickr=TRUE&&user_id=48508968@N00&&tag_mode=any"]

swf() syntax for PHP

$files = array('a.jpg');

	    print   swf($files, array(
	      'methods' => array(
	      'player' => 'tiltviewer',
	      'action' => 'swftools_image_display_list',
	      'swftools_player_path' => ''
	      ),
	      'flashvars' => array(
	      'useFlickr' => "TRUE",
	      'user_id' =>"48508968@N00",
	      'tags' =>"",
	      'tag_mode' =>"any",
	      ),

	      ));

All flashvars are explaint on the tiltviewer webpage

http://www.simpleviewer.net/tiltviewer/config_options.html

Download tiltviewer and store the folder in the shares directory
implementing of tiltviewer:
store all files in the swftools directory
modules/swftools/tiltviewer
tiltviewer.admin.inc

// $Id$

function tiltviewer_admin_form($flat = FALSE) {

  $form['tiltviewer_miscellaneous'] = array(
    '#type' => 'fieldset',
    '#title' => t('General Settings'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['tiltviewer_dimensions'] = array(
    '#type' => 'fieldset',
    '#title' => t('Dimensions'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#description' => t('All dimensions should be given in pixels.'),
  );
    $form['tiltviewer_miscellaneous']['tiltviewer_swf_useFlickr'] = array(
    '#type' => 'checkbox',
    '#default_value' => variable_get('tiltviewer_swf_useFlickr', FALSE),
    '#title' => t('Use Flickr'),
    '#description' => t('Use Flickr'),
  );
    $form['tiltviewer_miscellaneous']['tiltviewer_swf_linklabel'] = array(
    '#type' => 'textfield',
    '#default_value' => variable_get('tiltviewer_swf_linklabel', 'view image info'),
    '#size' => 50,
    '#maxlength' => 50,
    '#title' => t('Image Info'),
    '#description' => t('Image info'),
    '#required' => TRUE,
  );
    $form['tiltviewer_miscellaneous']['tiltviewer_swf_langgofull'] = array(
    '#type' => 'textfield',
    '#default_value' => variable_get('tiltviewer_swf_langgofull', 'view image info'),
    '#size' => 50,
    '#maxlength' => 50,
    '#title' => t(' Go Fullscreen '),
    '#description' => t(' Go Fullscreen '),
    '#required' => TRUE,
  );
    $form['tiltviewer_miscellaneous']['tiltviewer_swf_langexitfull'] = array(
    '#type' => 'textfield',
    '#default_value' => variable_get('tiltviewer_swf_langexitfull', 'view image info'),
    '#size' => 50,
    '#maxlength' => 50,
    '#title' => t(' Exit Fullscreen '),
    '#description' => t(' Exit Fullscreen '),
    '#required' => TRUE,
  );
    $form['tiltviewer_miscellaneous']['tiltviewer_swf_langAbout'] = array(
    '#type' => 'textfield',
    '#default_value' => variable_get('tiltviewer_swf_langAbout', 'view image info'),
    '#size' => 50,
    '#maxlength' => 50,
    '#title' => t(' About '),
    '#description' => t(' About '),
    '#required' => TRUE,
  );
  $form['tiltviewer_dimensions']['tiltviewer_swf_height'] = array(
    '#type' => 'textfield',
    '#default_value' => variable_get('tiltviewer_swf_height', 700),
    '#size' => 5,
    '#maxlength' => 5,
    '#title' => t('heigth of image'),
    '#required' => TRUE,
  );
  $form['tiltviewer_dimensions']['tiltviewer_swf_width'] = array(
    '#type' => 'textfield',
    '#default_value' => variable_get('tiltviewer_swf_width', 700),
    '#size' => 5,
    '#maxlength' => 5,
    '#title' => t('width of image'),
    '#required' => TRUE,
  );
  $form['tiltviewer_dimensions']['tiltviewer_swf_maxJPGSize'] = array(
    '#type' => 'textfield',
    '#default_value' => variable_get('tiltviewer_swf_maxJPGSize', 1200),
    '#size' => 5,
    '#maxlength' => 5,
    '#title' => t('the biggest size of an image'),
    '#required' => TRUE,
  );
  $form['tiltviewer_colors'] = array(
    '#type' => 'fieldset',
    '#title' => t('Colors'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#description' => t('All colors should be given as hexadecimal rgb-values like \'0xFFFFFF\'.'),
  );
  $form['tiltviewer_colors']['tiltviewer_swf_bkgndInnerColor'] = array(
    '#type' => 'textfield',
    '#default_value' => variable_get('tiltviewer_swf_bkgndInnerColor', '0x333333'),
    '#size' => 9,
    '#maxlength' => 8,
    '#title' => t('Background inner Color '),
    '#description' => t('Background  inner color of flash animation.'),
    '#required' => TRUE,
  );
  $form['tiltviewer_colors']['tiltviewer_swf_bkgndOuterColor'] = array(
    '#type' => 'textfield',
    '#default_value' => variable_get('tiltviewer_swf_bkgndOuterColor', '0x000000'),
    '#size' => 9,
    '#maxlength' => 8,
    '#title' => t('Background outer Color '),
    '#description' => t('Background outer color of flash animation.'),
    '#required' => TRUE,
  );
    $form['tiltviewer_colors']['tiltviewer_swf_backcolor'] = array(
    '#type' => 'textfield',
    '#default_value' => variable_get('tiltviewer_swf_backcolor', '0xFFFF00'),
    '#size' => 9,
    '#maxlength' => 8,
    '#title' => t('Background  Color '),
    '#description' => t('Background color of flash animation.'),
    '#required' => TRUE,
  );
  $form['tiltviewer_colors']['tiltviewer_swf_textColor'] = array(
    '#type' => 'textfield',
    '#default_value' => variable_get('tiltviewer_swf_textColor', '0x181818'),
    '#size' => 9,
    '#maxlength' => 8,
    '#title' => t('Text color'),
    '#description' => t('Color of title and caption text.'),
    '#required' => TRUE,
  );
  $form['tiltviewer_colors']['tiltviewer_swf_framecolor'] = array(
    '#type' => 'textfield',
    '#default_value' => variable_get('tiltviewer_swf_framecolor', '0xFFFFFF'),
    '#size' => 9,
    '#maxlength' => 8,
    '#title' => t('Frame color'),
    '#description' => t('Color of image frame, navigation buttons (on top and hover buttons) and thumbnail frame.'),
    '#required' => TRUE,
  ); 
  $form['tiltviewer_navigation'] = array(
    '#type' => 'fieldset',
    '#title' => t('Navigation'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
    $form['tiltviewer_navigation']['tiltviewer_swf_usereloadbutton'] = array(
    '#type' => 'checkbox',
    '#default_value' => variable_get('tiltviewer_swf_usereloadbutton', 0),
    '#title' => t('Use reload Button'),
    '#description' => t('Use reload Button'),
  );
    $form['tiltviewer_navigation']['tiltviewer_swf_showflipbutton'] = array(
    '#type' => 'checkbox',
    '#default_value' => variable_get('tiltviewer_swf_showflipbutton', 0),
    '#title' => t('Show flip Button'),
    '#description' => t('Show flip Button'),
  );
    $form['tiltviewer_navigation']['tiltviewer_swf_showlinkbutton'] = array(
    '#type' => 'checkbox',
    '#default_value' => variable_get('tiltviewer_swf_showlinkbutton', 0),
    '#title' => t('Show link Button'),
    '#description' => t('Show link Button'),
  );
  $options_1 = drupal_map_assoc(array(0, 1, 2, 3, 4, 5));
  $form['tiltviewer_navigation']['tiltviewer_swf_columns'] = array(
    '#type' => 'select',
    '#options' => $options_1,
    '#default_value' => variable_get('tiltviewer_swf_columns', 5),
    '#title' => t('Gallerie columns'),
    '#description' => t('Number of  columns. To disable columns completely set this value to 0'),
  );
  $form['tiltviewer_navigation']['tiltviewer_swf_rows'] = array(
    '#type' => 'select',
    '#options' => $options_1,
    '#default_value' => variable_get('tiltviewer_swf_rows', 5),
    '#title' => t('Gallerie rows'),
    '#description' => t('Number of  rows. To disable completely set this value to 0.'),
  );
/*
  $form['miscellaneous']['tiltviewer_rebuild_thumbs'] = array(
    '#type' => 'checkbox',
    '#default_value' => 0,
    '#title' => t('Build thumbnail library'),
    '#description' => t('Normally, you should do this only once, after installing the module. This builds a library of thumbnails based on pre-existing images which reside inside pre-exising galleries. You do not have to repeat this later on: images that are created after installing this module are handled automatically. '),
  );
*/

  if ($flat === TRUE) {
    return array_merge($form['tiltviewer_dimensions'], $form['tiltviewer_colors'], $form['tiltviewer_navigation'], $form['tiltviewer_miscellaneous']);
  }
  else {

    // Clear all caches
    drupal_flush_all_caches();

    return system_settings_form($form);
  }
}

//do not use closing Tags

tiltviewer.modul

// $Id$

/**
 * SWF Tools - tiltviewer.module
 *
 * Enables the use of tiltviewer Flash
 * 
 * for image gallery display. tiltviewer must be downloaded separately.
 *
 * Author's Site.
 * http://www.airtightinteractive.com/tiltviewer/
 */

define('tiltviewer', 'tiltviewer'); // 'player', shows multiple images.


/**
 * Implementation of swftools_methods hook
 * Report methods back to SWF Tools
 */
function tiltviewer_swftools_methods() {

  $methods = array();
  $image_rotator = array(
    'name'        => tiltviewer,
    'module'      => 'tiltviewer',
    'shared_file' => 'tiltviewer/tiltviewer.swf',
    'file'        => 'xmlURL',
    'version'     => '7',
    'title'       => t('tiltviewer'),
    'download'    => 'http://www.simpleviewer.net/tiltviewer/',
    'width'       => '500',
    'height'      => '500',
  );
  

  $methods[SWFTOOLS_IMAGE_DISPLAY_LIST][tiltviewer] = $image_rotator;
  return $methods;
}


/**
 * Implementation of hook_menu().
 */
function tiltviewer_menu() {
  $items = array();

    $items['admin/settings/swftools/tiltviewer'] = array(
      'title' => 'tiltviewer',
      'description' => 'Settings for <a href="http://www.airtightinteractive.com/tiltviewer/">Airtight Interactive\'s tiltviewer</a> image gallery.',
      'weight' => 1,

      'access arguments' => array('administer flash'),
      'page callback' => 'drupal_get_form',
      'page arguments' => array('tiltviewer_admin_form'),
      'file' => 'tiltviewer.admin.inc',
      'file path' => drupal_get_path('module', 'tiltviewer'),


      );

  return $items;
}

/**
 * Implementation of swftools_flashvars hook
 * Allows the Flash player provider to add variables to the Flashvars array.
 * Other arrays can also be modified.
 *
 */
function tiltviewer_swftools_flashvars($action, &$methods, &$vars) {
  $sv_vars = _tiltviewer_vars();

  // Here we only assign 'other' settings to othervars, and return 'swf' settings
  // as the flashvars. 'xml' settings are for the xml file only.
  // See http://www.airtightinteractive.com/forum/viewtopic.php?t=4085&start=0
  
  
  if (is_array($sv_vars['other'])) {
    $vars->othervars = array_merge($sv_vars['other'], $vars->othervars);
  }
  
    if (is_array($vars->flashvars)) {
    $sv_vars['swf'] = array_merge($sv_vars['swf'], $vars->flashvars);
  }
  
  return $sv_vars['swf'];
}


/**
 * These are the default options and flashvars.
 *
 */
function _tiltviewer_vars() {

  include_once(drupal_get_path('module', 'tiltviewer') .'/tiltviewer.admin.inc');
  // Grab the admin form and use all of the default values as settings for the flash embedding.
  $sv_vars = tiltviewer_admin_form(TRUE);

  foreach (element_children($sv_vars) AS $name) {
    $name_parts = explode('_', $name);
    if ($name_parts[1] == 'xml') {
      // The last part of the Drupal variable name matches the tiltviewer XML option name
      $return['xml'][$name_parts[2]] = $sv_vars[$name]['#default_value'];
    }
    elseif ($name_parts[1] == 'swf') {
      $return['swf'][$name_parts[2]] = $sv_vars[$name]['#default_value'];
    }
    else {
      $return['other'][$name_parts[2]] = $sv_vars[$name]['#default_value'];
    }
  }
  return $return;
}


function tiltviewer_tiltviewer_swftools_playlist($playlist_data, &$method, &$vars) {

  $sv_vars = _tiltviewer_vars();
  $sv_vars['xml'][]=0;
  $xml_vars = array_merge($sv_vars['xml'], $vars->flashvars);

  $xml = '<?xml version="1.0" encoding="UTF-8"

'."\n";
$xml .= '';

foreach($playlist_data['playlist'] AS $track => $details) {

// Strip default sites path if it is present
if (strpos($details['filename'], file_create_path()) === 0) {
$details['filename'] = str_replace(file_create_path() . '/', '', $details['filename']);
}

$xml .= '

'. $details['filename']. '
'. $details['filename'] .'
';
}

$xml .= "\n";

return $xml;
}
?> //do not using closing tags

tiltviewer.info
// $Id$
name = TiltViewer
description = Enables support for TiltViewer.
package = SWF Tools
dependencies[] = swftools
core = 6.x

Comments

Stuart Greenfield’s picture

Version: 6.x-2.5 » 6.x-3.x-dev
Assigned: karl2011 » Unassigned

I'm just getting round to the "new features" part of the upgrade. I'm just exploring TiltViewer, and will have a look at using this code to make a new module.

The only problem is the sheer number of modules that SWF Tools has now - the challenge will be supporting them all, and keeping the quality of the modules up!!

Stuart Greenfield’s picture

I've started on this - firstly I have upgraded the existing SimpleViewer module so we now have flickr integration in there.

Other SimpleViewer modules will now follow...

The format for SimpleViewer is that you can create a configuration on the settings page, including giving a user name and tags. Configure SimpleViewer as your image handler, then you can render it where you want it with [swf action="image_list"].

That's not very helpful as you wouldn't be able to use SimpleViewer for your own local playlist, so the easiest thing is make a profile in which Flickr integration is enabled.

Then you can write [swf action="image_list" profile="flickr"]. Now you can have a Flickr linked viewer, but you can have other profiles that link to regular files, or to a different flickr user.

Lastly, you can call any user via the filter using [swf action="image_list" profile="flickr" flickrUserName="<username>"].

Stuart Greenfield’s picture

Status: Active » Needs review

Tiltviewer is now on DRUPAL-6--3 and working great. It is profile enabled (as all new player modules will be), and Flickr integration is working.

It works brilliantly with the new Views integration too. You can create a TiltViewer that shows the image on the front and has the node title and body on the back, so you can create a really nice looking gallery very easily now.

Like SimpleViewer the best thing is to use a profile to create Flickr enabled TiltViewers.

Other than that it's pretty much as for SimpleViewer.

To render a TiltViewer in a node using the input filter then the minimum, assuming you created a profile with a username or some tags, is [swf action="image_list" profile="flickr_tilt"].

To over-ride the settings in the filter you can simply provide them as parameters, so to retrieve a specific user you could use [swf action="image_list" player="tiltviewer" useFlickr="true" user_id="49503180180@N01" maxJPGSize="500"].

In that filter we are making sure we use Flickr even if the configuration says use a local gallery, we are giving a user_id (note - TiltViewer uses user id, not user name!), and then we also set the maxJPGSize to be sure our Flickr gallery looks nice.

At the moment the config page is complete for the basic settings. I've not done Pro settings as I had enough of writings a settings page today!

Stuart Greenfield’s picture

TiltViewer support is already done. It's implemented as part of the SimpleViewer module as the code was pretty short and they come from the same source provider so I decided not to make an entire module for it. Post #3 describes how to use it, included Flickr integration.

fabrik’s picture

First thanks for your work and sorry for my bad english,

I use tiltviewer with swftools and it works well with flickr integration.
Unlucky, I don't know how to do with my own pictures.
In fact, I used [swf action="image_list" player="tiltviewer" useFlickr="true" user_id="49503180180@N01" maxJPGSize="500"] in a special input format and it works pretty good with the flickr integration.

But for my work, I need to use my own pictures.
I first try to create a new content type with an image field and display it with swf tools playlist... It works well but the title of the image don't appear and I can't control the description text ( font-size ... ) on the flip for the image and more important for me, I have no control at all on the link for the image.

Then, I think, maybe the best for me is to use a gallery.xml files for my pictures to have a better control.

I try this
[swf action="image_list" player="tiltviewer" useFlickr="false" xmlURL="gallery.xml" maxJPGSize="500"] but no pictures appears...

my two files gallery.xml and imgs are in modules/swftools/tiltviewer

Then, I don't know how to make the call to gallery.xml ?
Where can i use the propriety xmlURL ?

Also, when I display tiltviewer with CCk and imagefield :
I try to play with the template swftools-tiltviewer-playlist-element.tpl.php then I saw normaly I should have a title for my image in the flip with the line 44 print '<title>' . check_plain($element['title']) . '</title>';
but I have no title on the flip of the image
In fact, it works when I change this line 44 for :
print '<title>' . my title . '</title>';
but in this case the description of the image disappears in the flip in despite of the line 45 of the same template :
print '<description>' . check_plain($element['description']) . '</description>';

As you can see I try many directions but I am a little lost...

Thank you