really enjoy your module. It would though be nice if Thickbox could be integrated. Right now when I activate the link settings I'm just being directed to the image thus leaving the page. Using thickbox to display the full image would just look soooo much nicer.

Keep it up.

Comments

JamieR’s picture

Thickbox integration is quite simple... here is a patch against 5.x-1.1.

All I did was add the tags that thickbox wants on the images. I'm happy to add auto detection or a setting to turn it on and off or whatever...
What do you think? http://five.marmot.com/node/3

rapsli’s picture

Way cool!

JamieR’s picture

Hey, even better, is that if you don't want to mess with the module at all, you can simply override the theme... just add this to your template.php file:

function phptemplate_inline_img($file, $field) {
  $title = (!empty($file->title) ? $file->title : $file->filename);
  $inline_preset = $field == 'teaser' ? 'inline_teaser_preset' : 'inline_full_preset';
  
  if (module_exists('imagecache') && variable_get($inline_preset, '') != '') {
    $image = theme('imagecache',
      variable_get($inline_preset, ''),
      $file->filepath,
      $title,
      $title,
      array('class' => 'inline')
    );
  }
  else {
    $image = theme('image',
      $file->filepath,
      $title,
      $title,
      array('class' => 'inline')
    );
  }

  if (variable_get('inline_link_img', '1')) {
    $attributes = array(
      'class' => 'inline-image-link thickbox',
      'rel' => 'gallery-' . $file->nid,
      'title' => t("View") .': '. $title,
    );
    $html = l($image, $file->filepath, $attributes, NULL, NULL, FALSE, TRUE);
  }
  else {
    $html = $image;
  }
  
  return $html;
}

It's just the patched function copied into the theme with the function name changed.
More info: http://drupal.org/node/55126
?>
Happy theming!

sun’s picture

Status: Active » Needs work

@JamieR: Could you post the (missing) patch from #1 again, please?

JamieR’s picture

StatusFileSize
new482 bytes

Sure... sorry I forgot the patch the first time.
I made one for the 5.x-1.1 version and one against HEAD.

Thanks, Jamie.

JamieR’s picture

Status: Needs work » Needs review
StatusFileSize
new477 bytes

Hmmm... having problems with the attachment. Maybe that's why it didn't appear on the original post...

micahw156’s picture

Patch #6 worked for me in a couple of different environments:

  • Drupal 5.7, ImageCache 5.x-1.6, Thickbox 5.x-1.2
  • Drupal 5.7, ImageAPI 5.x-1.2, ImageCache 5.x-2.1, Thickbox 5.x-2.0

Patch applied to latest (2008-Jun-15) 5.x-1.x-dev.

sun’s picture

Well, I'm putting this on-hold for just one reason: I've implemented multiple add-on scripts in jQuery Lightbox that add the necessary attributes to Inline, Image Assist, Image, and Image Gallery images to load them in a jQuery Lightbox.

My key question is whether Inline really should implement support for a never-ending list of JavaScript behaviors, or whether all of this should happen the other way around: A JavaScript behavior (like Thickbox) that wants to support Inline (and other contents) needs to implement support for that content on its own.

JamieR’s picture

True.

But it might be nice to put a note in the instruction with an example of how to use the theme override functions to add support of other javascript libraries?

Just a thought.

I wish I had known that jQuery Lightbox was already integrated... so many modules... I would love to see for each module a list of other modules that have been designed to work together... that would be nice. :)

Keep up the great work.
Jamie.

sun’s picture

Well, a theme override function would be a culprit for regular users.

What if we would add a

$attributes = array_merge($attributes, module_invoke_all('inline_attributes' [, $context] ));

right after the definition of $attributes? That would allow any module to alter the attributes of the embedded image.
I thought of $context being a $node object, but that's not (yet) available in this case.

JamieR’s picture

I love it.

I'm not familiar enough with the project to understand how you would use the $context var, but it would be great to have that functionality available for integration.

lsrzj’s picture

Simpler than patching the module it's better to patch inline.theme.inc. Search for 'class' => 'inline-image-link and then add thickbox in front of it. So it'll look like this 'class' => 'inline-image-link thickbox'. That way all inline images will be part of two classes inline-image-link and thickbox. I did this way and everything went ok.

lsrzj’s picture

StatusFileSize
new503 bytes

The patch attached, this is for version 6.x-1.0