Currently, the inline filter generates an image with class="inline". I propose a class tag be made available to override that default.

Something like [inline:1 class=thumbnail], then the filter would pass that class name through to the html.

This would allow CSS some very nice control over image layout on the page.

Comments

matteo’s picture

I agree on this feature, I'll put it on my todo list.
Matteo

Bèr Kessels’s picture

I disagree on this. Simplicity is the inline modules power. I beleive that for more powerfull inline images one should use a more powerfull module, such as image handler. IMO we should really keep the inline module As simple as possible: no optional parameters, only a number of a filename.

matteo’s picture

Assigned: Unassigned » matteo

This optional parameter can provide several benefits in terms of look&feel of the page.
I want to maintain the module simple, and I don't think an optional parameter can change dramatically the simplicity of the module..... don't you think so ??
Matteo

Anonymous’s picture

What I really liked about this module is that it had (has!) no parameters.
IMO there's a quite big difference between:
[inline:1] or [inline:mycat.jpg]
and
[inline:1|class]

The first is simple because it takes /no/ parameters at all.
But I do agree about the class issue. It would in some cases be nice to be able to say: align this pic left and this one right. But.... in those cases people should take another module.

So i suggest one of the following:
People should theme the inline-function and add classes/ids in that theme function. That way they can align/float all images to one place. (we have this now, IMO for 90% it will suffice, those 10% should -again- use other image-modules)
OR
People should have two inline filters available. Inline filter can add two filters: An advanced and a simple. That way admins can set the simple one for those that cannot use classes, but can enable the advanced one for admins.
OR
People should use other markup-systems, such as wiki/textile to wrap tokens in markup. e.g:
__[inline:mycat.jpg]__ will be rendered as

<span class="em"><img src="files/mycat" class="inline" /></span>

but the wiki-(or textile) module will then take care of itl

Bèr Kessels’s picture

forgot to log in. Abovementioned comment is mine (Bèr)

stevew’s picture

In my mind, the role of the inline module is to allow users to add an image to a post without that image already having been loaded to the image.module. It is, as far as I know, the only way to do that with Drupal. An addition to allow better control over the layout of the attached images does not seem to me to be outside the scope of the module.

I did not consider that the module output was themeable, so I will look into that. But the reason I brought it up was that there is already a class being attached to the output. When you look at the page source, there is a 'class="inline"' in there. This already happens without any user interaction.

I do not propose to change that behavior - the default action of the filter should not change from the way it works now. But if the person knows to use the optional class, for example [inline:2 class="floatright"], in order to control the location of the picture, I think it would be a useful addition to the tool. It seems, from my view on the outside, to be a much smaller change than to create a new inline module.

Aress’s picture

I'm agree with stevew, this feature will be very useful without makeng the module harder to use.
My two cents, Aress

matteo’s picture

I'm convinced of this feature and I'll implement it soon.
Unfortunately, I'm really busy on my primary job now, so please be patient....

Matteo

coloma’s picture

Apologies if I'm out of line here -- just started using Drupal a few days ago and am not sure of all the inter-working protocols.

Like most people here, I need to be able to inline images left or right or else center them on a separate line ... and also want to use alt/title parameters. I looked at this module and I see there is undocumented code for alt/title text:

[inline:1=this is alt text]
results in everything after the "=" being used in both title and alt fields. Great!

Not sure what syntax others want to use but I need something ASAP so I did a little hack to allow alignment:
[inline:1=align,this is alt text]
If "align" is one of {left,right}, then the hack adds an 'align="right"' or 'align="left"' param.

If "align" is set to "center" then it puts the img tag into a
<div align="center"></div>

If you enter "left" "right" or "center" with no comma, then the param is used for alignment; otherwise it's assumed to be alt text. E.g.,
[inline:1=this is alt text] is treated as alt text
[inline:1=left] is treated as alignment request

If I could just "wish it up" I'd ask for something parameterized more like the image_filter module (align=left class=this alt=that) but unfortunately multiple params are beyond my understanding of the Drupal architecture at this point. I know my solution is a kluge but can't wait for the real thing! :(

Here is the code in case anyone else has the same need:

Replace line 98:

      $html = ' <img src="'. $filepath. '" class="inline" alt="'. $title .'" title="'.$title.'"> ';

with the following:

      // parse for "align,alt" where align is one of {left,right,center}
	  $firstCommaPos = strpos($title,',');

      if ( $firstCommaPos === false ) {
        // we get here if no comma -- may be either alignment or alt
        switch ($title) {
          case  'left':
            $align = 'left';
            $title = '';
            break;
          case  'right':
            $align = 'right';
            $title = '';
            break;
          case  'center':
            $align = 'center';
            $title = '';
            break;
          default:
            $align = '';
        } // switch
      } else {
        // comma separates alignment from alt
        $align = substr($title,0,$firstCommaPos);
        $title = substr($title,$firstCommaPos+1);
      }
      if ( ($align === 'left') || ($align === 'right') ) {
        $alignTag = ' align="'.$align.'"';
      } else {
        $alignTag = '';
      }
      $html = ' <img src="'. $filepath. '" class="inline" alt="'. $title .'" title="'.$title.'"'.$alignTag.'> ';
      if ( $align === 'center' ) {
        $html = '<div align="center">'.$html.'</div>';
      }

It could probably be optimized, will probably go back to it when I am not under the gun to get a site working by Monday! Comments, suggestions, critique of course are all welcome.

Richard Archer’s picture

Status: Active » Closed (duplicate)

This will all be taken care of when this patch is committed:
http://drupal.org/node/32838