[pmwiki-users] improved markup for floating images...?

Patrick R. Michaud pmichaud at pobox.com
Tue Jul 26 09:31:35 CDT 2005


On Tue, Jul 26, 2005 at 03:01:21PM +0100, Ed W wrote:
> Apologies.  My previous email sounded more like a winge than it was meant
> to be...

No problem--I've also been under the weather the past 3 days and so my
response might've also been more strongly worded than it needed to be.

> : We can do img:xxx for images, but it ends up looking an awful lot
> : like an InterMap link, and seems as though it would end up being
> : treated a lot differently.
> 
> I'm about to have a bash at some code on this and I'm not quite sure what
> you mean?

>From a markup syntax perspective, nearly everything in PmWiki that is of the
form "word:xxx" is a link to some sort of resource; i.e., "http:",
"ftp:", "Attach:", "Wiki:", etc.  

If we use "img:" for images and give it all sorts of special capabilities
like resizing and floating, then it somehow breaks that model, or at
least introduces something special beyond what InterMap links normally
do.

> Just talking use case for a moment, I think what I am after is something a
> bit like the attach: syntax, but with knobs on.  Referencing the mediawiki
> image: tag for a moment I would like to be able to do all the following
> 
>    A picture: [[Image:Wiki.png]]

In PmWiki:   Attach:Wiki.png

>    or, with alternative text:
>    [[Image:Wiki.png|jigsaw globe]]

In PmWiki:   Attach:Wiki.png"jigsaw globe"

>    or, floating to the right side of the page and with a caption (and CSS
>    frame):
>    [[Image:Wiki.png|frame|Wikipedia Encyclopedia]]

We don't have an equivalent for this yet, but we can see about
developing one.  From an author perspective I have trouble seeing why
this last one isn't using "frame" as the alternative text (compare
to the "jigsaw globe" example immediately above).

>    or, floating to the right side of the page ''without'' a caption or frame:
>    [[Image:Wiki.png|right]]
>    Basically the following options are supported: right, left, center, none,
>    sizepx, thumbnail (thumb), frame, and alternate (caption) text.

Okay; one of the things that bugs me about this syntax is that whatever
comes after the "|" is sometimes text and sometimes an option of some
sort.

>    I propose to support the resizing by making it mangle the image name to
>    encode the resized file size.  Something like Wiki.png.500px or similar. 
>    Then we can simply test for the existence of a given resized picture at
>    delivery - create and store it if it doesn't exist, otherwise just serve
>    it straight up.

Well, in designing this let's keep in mind that (1) not every PHP
installation has the ability (or resources) to resize graphic images
on the server, and (2) not every image is stored locally on the server.

>    How does this sound?  Notice how wikipedia use [[image:xxx]] in square
>    brackets, do you want the syntax for pm to loose the [[..]]?
>    http://en.wikipedia.org/wiki/Image_markup

I definitely don't want to change PmWiki's current meaning of the
double square brackets, so yes, whatever syntax we come up with can't
rely on them to denote "image".  

I personally like the fact that any link ending in .gif/.png/.jpg
is automatically treated as an image.  So perhaps we just need to
extend PmWiki's alt-text markup in the MediaWiki style...?

    Attach:something.jpg"Alt text|right|300x400"

>    Notice also (rather interestingly) that they tend to float an image by
>    default and you have to use a style="clear:both" to prevent it (which is
>    actually easier I think than having a bunch of different ways to float it
>    or not, just make the break explicit?)

Which side does the image float to by default?

PmWiki 1 used to do something similar to this -- an image appearing at the
start of a markup line would automatically float left, and an image 
at the end of a markup line would automatically float right.  I ended
up removing this for PmWiki 2 because it was greatly complicating
wikistyle handling and because it was occurring too "invisibly" for
many authors to detect, so the explicit markup seemed better.  But floating 
by default in absence of other information might also be useful.

>    Other syntax not discussed, but it should be possible is to use the image
>    as the display item of a link, ie something like this should be valid.:
> 
>    [[Topic|image:somepicture.jpg]]

In PmWiki:  [[Topic | Attach:somepicture.jpg]], or even
   [[Topic | Attach:somepicture.jpg"alt text"]]

Pm




More information about the pmwiki-users mailing list