[Mediawiki-l] DPL, Thumbnails and image resizing

Giuseppe Briotti g.briotti at mclink.it
Fri Nov 23 22:44:45 UTC 2007


Hi all, I need some hints about this problem:
I need to create a gallery with images from a category.

First I started with this piece of code:

{{#dpl:
  |category = {{{categoria}}}
  |namespace = Image
  |mode = userformat
  |format = «gallery»,%PAGE%¦%TITLE%\n,,«/gallery»
  |noresultsheader = No image in this category.
}}


But the result is not so good, as you can see here:

http://www.usnb.it/wiki/index.php?title=Materiale_di_Supporto:Gli_Stemmi_dei_Casati

all the coats of arms are in the same size, but the pictures differs because there 
are different crowns. The resizing in thumbnails is not so good.... and it seems that
it is not possible to passing a template to <gallery> for image rendering.

Thus I adopted this solution:

{{#dpl:
  |category = Stemmi dei Casati
  |namespace = Immagine
  |mode = userformat
  |format = «table border="1"»«tr»,«td valign=bottom»²{ImagePerc¦immagine=%TITLE%¦larghezza=100¦descrizione=%TITLE%}² ,«/td»²{#if: ²{#pos:%NR%¦0}² ¦ «/tr»«tr» ¦ }²,«/tr»«/table»
  |noresultsheader = Nessuna immagine in questa categoria, per il momento.
}}

ImagePerc is a template able to resizing an image both by percentage and pixel
width:

[[Image:{{{immagine}}}|{{ #if:{{#pos:{{{larghezza|100}}}|px}}|{{{larghezza|100}}}| {{#expr: ({{#imgw: {{{immagine}}} }} * {{{larghezza|100}}}) / 100 }}px }}|{{{descrizione|}}}]]

#imgw is a parser function able to retrieve the width of the given image.

The result seem better, but the </tr><tr> are rendered as string and not tags,
despite the DPL escape characters adopted. 

http://www.usnb.it/wiki/index.php?title=Template:CategoryGallery2

Any hints?

Thanks

Giuseppe Briotti
--

Giuseppe Briotti
g.briotti at mclink.it

"Alme Sol, curru nitido diem qui 
promis et celas aliusque et idem 
nasceris, possis nihil urbe Roma 
visere maius."
                        (Orazio)







More information about the MediaWiki-l mailing list