Bruche mer nit, fott domet

Ich fordere ein Verbot aller Schützenvereine und das Verbot jeglichen privaten Schusswaffenbesitzes!

Und wehe es kommt mir nochmal einer von wegen Computerspielen …

Hamburch meets Kölle

Wir haben am Wochenende liebe Freunde aus Hamburg zu Besuch gehabt. Das Wetter hat leider nicht nicht so mitgespielt, sonst hätte man so einem Dorfbewohner ‘mal eine schöne große Stadt zeigen können. ;)

So erstreckte sich das Wochenende auf Shopping (ich sag ja: Dorfbewohner :D) und lecker Essen gehen. War aber sehr nett. Man sieht sich leider viel zu selten.

Illegale Downloads...

…haben Konsequenzen, wie man bei “The IT Crowd” erfahren kann. Die Serie über zwei Computernerds im Keller einer großen Firma dürfte hierzulande noch nicht sehr bekannt sein, ist aber, abgesehen vom manchmal etwas zu hysterischen Agieren der Departementchefin durchaus empfehlenswert. In der oben verlinkten Folge geht es übrigens darum, dass Moss, einer der beiden Helden durch ein kleines sprachliches Mißverständnis in einer Anzeige nicht bei einem Kochkurs landet, sondern von einem cellospielenden deutschen Kannibalen verspeist werden soll. Was würden die Engländer ohne uns nur machen…

Warnung vor dem Stillstand

Ich war gestern seit langer Zeit mal wieder im Kino. Und zwar bei The Day the Earth Stood Still. Hiermit sei eine entsprechende Warnung ausgesprochen:

  • Keanu Reeves beherrscht auch in diesem Film nur eine Mimik, bewegen kann er sich auch nicht.
  • Der Plot ist…äh…simple, vorhersehbar, bekannt (ohne, dass ich das Original kenne).
  • Die Charaktere sind dermaßen grob geschnitzt…
  • Das Productplacement im Film ist ziemlich aufdringlich, nein, zu aufdringlich.

Alles in allem war ich ziemlich enttäuscht. Der Film ist mäßig, lau und überflüssig.

yab_image: another image plugin for textpattern

Yes, another image plugin for textpattern. :)

What it does

This plugin allows you to display an image with an assigned caption as caption :). The width of the caption will always fits the width of the displayed image.

The problem

In textpattern you have an option to give an uploaded image a caption, but textpattern will show this caption via textile, tag <txp:image /> or html only as title attribute of the image element. This is not a real image-caption aka image-subtitle.

If you want a real image-caption in textpattern so you have to work with different <span> in your body with textile or with raw html. The next problems are the different widths of the images and the caption (subtitle) below.

Here is an example what I mean:


Example Picture 1 This is a caption with an appropriate width Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.

Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim.

Example Picture 1 This is a longer caption and the width could break your layout Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.

Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim.


Solution

If you know this problem and you often use or want to use image-captions then maybe yab_image is a solution for you. The example above will with <txp:yab_image /> look like this:

Example Picture 2This is a longer caption of the image. With yab_image the caption doesn't break your layout.Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.

Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim.

Usage

You can use this plugin almost the same as <txp:image />. The behavior is a little bit different: If a caption for an image is available and if you want to float the image and the caption, use the align attribute. This will float the image and the caption.

If no image caption (neither as tag attribute nor in image tab) is given <txp:yab_image /> works similar as <txp:image />·

F.i.: <txp:yab_image id="5" align="right" />

Attributes

The following attributes works as expected (as in <txp:image />·) when no caption is given:

id
Specifies the id assigned at upload of the image to display. Can be found on the images tab. If both name and id are specified, name is used while id is ignored.
(Integer)
name
Specifies which image to display by its image name as shown on the images tab.
(String)
class
CSS class attribute applied to the wraptag, if set, otherwise to the img tag.
(Default: unset)
escape
Escape HTML entities such as <, > and & for the image’s alt and title attributes.
(Default: unset)
html_id
The HTML id attribute applied to the wraptag, if set, otherwise to the img tag.
(Default: unset)
style
Inline CSS style rule.
(Default: unset)
wraptag
HTML tag to be used to wrap the img tag, specified without brackets.
(Default: unset)

The following attributes are new oder modified:

align
Alignment of the image and the caption.
left, right, center (default: center)
alt_caption
Alternate caption, overwrites caption given in image tab.
(Default: unset)
alt_alt
Alternate img alt, overwrites alternate text given in image tab.
(Default: unset)
alt_title
Alternate title, overwrites caption text given in image tab, which is regulary used for img title attribute.
(Default: unset)
alt_as_title
If set, the alt_alt tag attribute or the alternate text is used for the img title attribute.
(Default: 0)

Some weird logic and priorities:

Tag attributes will always overwrites given text in the image tab!

Intentionally usage of alt_as_title tag attribute:
Mainly it could be used for displaying hyperlinks in the caption (the thingy, which is shown under the image) without breaking the HTML validity.
If you want to display hyperlinks in the caption so you can either write these hyperlinks as raw HTML in the caption field in your image tab or as textile markup in the tag attribute:

F.i.: <txp:yab_image id="5" align="right" alt_caption='This is a "Link (Link)":http://textpattern.com/ in a caption' />

Important:

  • Use single quotes for tags when insert double quotes!
  • Don’t start with an double quote (alt_caption='"Link (Link)":http://textpattern.com/ in a caption' will not work).
    Use a beginning whitespace or text before the double quote (alt_caption=' "Link (Link)":http://textpattern.com/ in a caption').
  • Be sure the line will be textiled.

Problem: The generated img title attribute is broken, because the hyperlink with the double quotes breaks it.
Solution: Now you can additionally use the alt_title tag attribute to set a specific img title or the alt_as_title so that the img title will generated from alternate text in the image tab.

F.i.: <txp:yab_image id="5" align="right" alt_caption='This is a "Link (Link)":http://textpattern.com/ in a caption' alt_as_title="1" />

or

F.i.: <txp:yab_image id="5" align="right" alt_caption='This is a "Link (Link)":http://textpattern.com/ in a caption' alt_title="Nice picture which shows something" />

Styling

The plugin will create new html elements:

If an image caption is given:
<small class="caption">given caption here</small>: This elements will wrap the caption.

And if additionally the attribute align is used:
<span class="img-caption-{align}">image+caption</span>, where {align} will be your given align: This span is wrapped around the image and the caption. So you have the ability to set different paddings for different floats.

You can always use the wraptag attribute to wrap all with another html element.
Depending on your usage and used wraptag you have to clear the floats.

As of version 0.3 <txp:yab_image /> will produce (X)HTML-strict output. The align attribute in the image element will be completly removed. So the HTML-markup will be different from <txp:image />.

Download

yab_image_v0.5 plugin
yab_image v0.5 source

Changelog

  • 08-11-28 – v0.1
    • release
  • 08-11-30 – v0.2
    • added: alt_caption attribute for alternative captions
  • 09-04-08 – v0.3
    • removed image align attribute in html markup, so output will be (X)HMTL-strict
    • added different css classes for different floats for styling purpose
  • 10-09-24 – v0.4
    • can now handle hyperlinks in captions
    • added: alt_alt attribute for alternative img alt attribute
    • added: alt_title attribute for alternative img title attribute
    • added: alt_as_title attribute for alternative img title attribute
  • 2017-02-10 – v0.5
    • TXP 4.6-ready

neuere Einträge | ältere Einträge