Desire for auto width and height was described by Craigo:
http://community.wikidot.com/forum/t-252834/image:automatic-width-height-code
I would also like to let the alt and title attributes default to the filename.
Here are some suggested ways to let the user invoke automatic attributes:
attribute to be automated |
wiki syntax | html rendering |
---|---|---|
width | autowidth="x" | width="(native width)*x" |
height | autowidth="y" | height="(native height)*y" |
width & height | autosize="z" | width="(native width)*z" height="(native height)*z" |
alt | autoalt | alt="(filename)" |
title | autotitle | title="(filename)" |
alt & title | autotext | alt="(filename)" title="(filename)" |
Example:
Say you have a 200x100 pixel image called marmot.jpg.
wiki syntax | html rendering |
---|---|
[[image marmot.jpg]] | <image src="marmot.jpg" /> |
[[image marmot.jpg autotext]] | <image src="marmot.jpg" alt="marmot" title="marmot" /> |
[[image marmot.jpg autosize="1"]] | <image src="marmot.jpg" width="200px" height="100px" /> |
[[image marmot.jpg autowidth="1" autoheight="1.5" autoalt title="a 150% height marmot"]] | <image src="marmot.jpg" width="200px" height="150px" alt="marmot" title="a 150% height marmot" /> |
The above would be good for me, but you could go a step further and allow expressions with variables that refer to the image metadata:
%w | width |
%h | height |
%n | filename |
%x | file extension |
…lots more types of image metadata.
Example:
wiki syntax | html rendering |
---|---|
[[image marmot.jpg autowidth="3*%w" autoheight="3*%h" title="it's a triple scaled %n"]] | <image src="marmot.jpg" width="600px" height="300px" title="it's a triple scaled marmot" /> |
Imho this is a bit overkill, how othen is a picture stretched? Btw autoalt is already implemented in the wikisyntax as it is. On the other hand I think your idea of scaling is a good one… But I would sugest an attribute called scale and a numeric value like in
[[image some-picture.jpg scale="3"]]
This would scale it up to 300%
A - S I M P L E - P L A N by ARTiZEN a startingpoint for simple wikidot solutions.
I've read this wish several times and can't really decide if it's overkill or not. But the way I always deal with images is to use a local variation of the image box snippet in the live template and set the width but use height:auto to make sure there is no stretching. As I now mostly use dataforms this means I can upload any image to the form and it always displays correctly without constantly needing to make manual corrections to each one:
Rob Elliott - Strathpeffer, Scotland - Wikidot first line support & community admin team.
sorry for this, but…
I visited some sites that use some sort of automatic resize code "click to enlarge" and the image either enlarges right there on page or pops up and shows the image full size, almost like newegg and its image thumbnails.
That's called a lightbox and we have them on the [[gallery]] module, but that's not what has been requested in this wish.
Rob Elliott - Strathpeffer, Scotland - Wikidot first line support & community admin team.