Currently the D6 module was working for me, because of the names of the documents I was using. My second image (the sprite) ended with '-reel.jpg', so it was working well, but the "image: '$reelpath'" of the .reel call was not working as I thought it was.

drupal_add_js("$('#image360').reel({ frames: 35, saves: false, klass: 'spinner', image: '$reelpath' });", 'inline', 'footer');

Comments

ipwa’s picture

This is my formatter function:

function theme_reel_formatter_reel($element) {

  // Add jQuery 1.4 only if we are sure we are not the admin path
  if (arg(0) != "admin") { 
    drupal_add_js(drupal_get_path('module', 'reel') .'/js/jquery-1.4.4.min.js');
  }
  drupal_add_js(drupal_get_path('module', 'reel') .'/js/jquery.reel.js');

  //return  theme('imagefield_image', $item, $item['data']['alt'], $item['data']['title'], array('class' => $class));

	static $rendered;
	    if (!$rendered) {
	        $rendered = TRUE;
	        $formatter = $element['#formatter'];
	        $field_name = $element['#field_name'];
	        $item = $element['#item'];
	        $formatter = $element['#formatter'];
	        $nid = $element['#item']['nid'];
	        $node = node_load($element['#item']['nid']);;


	        $dets = explode('__', $formatter);
	        $preset = $dets[1];
	        $cur_image = 0;

	        if ($node->{$field_name}) {
		
             drupal_add_js("var $jq = jQuery.noConflict(); $jq$('#image360').reel({ frames: 35, saves: false, klass: 'spinner', image: ". $item['filepath'] ." });", 'inline', 'footer');
			 drupal_add_js("$('#image360').reel({ frames: 35, saves: false, klass: 'spinner', image: '$reelpath' });", 'inline', 'footer');


	          // Render the HTML 
	          $output = '';

	          foreach ($node->{$field_name} as $image) {

	            if ($image) {
	              $output = '<img id="image360" height="480" width="640" src="/drupal6/'. $item['filepath'] .'" />';      
	              $output .= dsm($element);
	            }

	          }        
	        }


	        return $output;
	    }

}
marvil07’s picture

Title: Fixing the reel image path » Clean theme_reel_formatter_reel()
Assigned: Unassigned » marvil07
Status: Active » Needs review
StatusFileSize
new6.01 KB

Here a patch that clean up the theme_reel_formatter_reel() function.

What I have done:

  • Using a custom id per field item instead of one custom(will help on i.e. a view when not all images can use the same id).
  • Loading js files only when both images are there.
  • Using alt and title supported by imagefield.
  • Do not loading the node. It is really not necessary.
  • Setting 'multiple values' => CONTENT_HANDLE_MODULE in the formatter info array to actually receive all field items on the theme.

Also removing lots of commented code.

ipwa’s picture

Status: Needs review » Fixed

Thanks so much Marco.

Committed: http://drupalcode.org/project/reel.git/commit/6cbb9f3

Should have an alpha release soon. w00t w00t!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.