Center an image

1,056 views
Skip to first unread message

Peter von Kaenel

unread,
Mar 5, 2009, 7:18:20 AM3/5/09
to trac-...@googlegroups.com

 

There must be a simple way (and it’s probably well documented), but I have not been able to figure out how to center an [[Image()]].  I was hoping to just use <c>[[Image()]]</c>, but that did not work.  Could someone help me out on this one?

 

Thanks,

Peter

 

 

ice....@gmail.com

unread,
Mar 5, 2009, 7:32:40 PM3/5/09
to Trac Users
Hi,

in my trac 0.11.3 installation the Help shows this:

[[Image]]

Embed an image in wiki-formatted text.

The first argument is the file specification. The file
specification may reference attachments in three ways:

* module:id:file, where module can be either wiki or ticket,
to refer to the attachment named file of the specified wiki page or
ticket.
* id:file: same as above, but id is either a ticket shorthand
or a Wiki page name.
* file to refer to a local attachment named 'file'. This only
works from within that wiki page or a ticket.

Also, the file specification may refer to repository files, using
the source:file syntax (source:file@rev works also).

Files can also be accessed with a direct URLs; /file for a project-
relative, //file for a server-relative, or http://server/file for
absolute location of the file.

The remaining arguments are optional and allow configuring the
attributes and style of the rendered <img> element:

* digits and unit are interpreted as the size (ex. 120, 25%)
for the image
* right, left, top or bottom are interpreted as the alignment
for the image
* link=some TracLinks... replaces the link to the image source
by the one specified using a TracLinks. If no value is specified, the
link is simply removed.
* nolink means without link to image source (deprecated, use
link=)
* key=value style are interpreted as HTML attributes or CSS
style indications for the image. Valid keys are:
o align, border, width, height, alt, title, longdesc,
class, id and usemap
o border can only be a number

Examples:
[[Image(photo.jpg)]] # simplest
[[Image(photo.jpg, 120px)]] # with image width
size
[[Image(photo.jpg, right)]] # aligned by
keyword
[[Image(photo.jpg, nolink)]] # without link to
source
[[Image(photo.jpg, align=right)]] # aligned by
attribute

Following the last example, i've tested align=center which doesn't
work. So there is only a possibility with

{{{
#!html
<h1 style="text-align: right; color: red">Image-Title</h1>
</p><div class="wiki-toc"><img src="/trac/raw-attachment/wiki/Images/
Image.png" width=250 height=250 ><p>
}}}

Put there annother class which follows the standard-syntax an you are
there, please let us know.

sincerely
Ice


On Mar 5, 1:18 pm, "Peter von Kaenel"

jevans

unread,
Mar 5, 2009, 10:12:57 PM3/5/09
to Trac Users

On Mar 5, 6:18 am, "Peter von Kaenel"
Well there's http://trac.edgewall.org/ticket/5223. Seems like the
resolution was more of a 'wontfix'.
Seems you're stuck with embedding HTML or div, or hacking the macro
(if you do that, please post it).
- jevans

Christian Boos

unread,
Mar 6, 2009, 5:57:09 AM3/6/09
to trac-...@googlegroups.com

Well, as getting a centered image is less trivial than it seems and
given we already have support for align=left/right, I think it makes
sense to add support for align=center. I'll reopen the ticket and
provide a patch.

-- Christian

Peter von Kaenel

unread,
Mar 6, 2009, 7:25:33 AM3/6/09
to trac-...@googlegroups.com

>Well, as getting a centered image is less trivial than it seems and
>given we already have support for align=left/right, I think it makes
>sense to add support for align=center. I'll reopen the ticket and
>provide a patch.
>
>-- Christian

That sounds great, thanks! I had no idea the can of worms I was
opening, but I do look forward to the patch.

Peter


Olemis Lang

unread,
Mar 6, 2009, 10:36:44 AM3/6/09
to trac-...@googlegroups.com
On Fri, Mar 6, 2009 at 5:57 AM, Christian Boos <cb...@neuf.fr> wrote:
> jevans wrote:
>> On Mar 5, 6:18 am, "Peter von Kaenel"
>> <Peter.vonKae...@harmonicinc.com> wrote:
>>
>> Well there's http://trac.edgewall.org/ticket/5223.  Seems like the
>> resolution was more of a 'wontfix'.
>
> Well, as getting a centered image is less trivial than it seems and
> given we already have support for align=left/right, I think it makes
> sense to add support for align=center. I'll reopen the ticket and
> provide a patch.
>

+1 ... wise words ... 0<|:)

--
Regards,

Olemis.

Blog ES: http://simelo-es.blogspot.com/
Blog EN: http://simelo-en.blogspot.com/

Featured article:
Clic y al Sur: Conociendo a Ubuntu Linux

Reply all
Reply to author
Forward
0 new messages