
|
[dokuwiki]
||
[Date Prev]
[05-2008 Date Index]
[Date Next]
||
[Thread Prev]
[05-2008 Thread Index]
[Thread Next]
[dokuwiki] Syntax for image cropping
- From: Andreas Gohr <andi@xxxxxxxxxxxxxx>
- To: dokuwiki@xxxxxxxxxxxxx
- Date: Fri, 16 May 2008 13:59:11 +0200
Hi *
I just added support for image cropping in DokuWiki's fetch.php this
allows things like the square thumbnails used on flickr.
Cropping is triggered when a parameter crop=1 is passed to fetch.php
Let me give you a few examples first for different calls for the same
image first (note I use URL rewriting and removed unneeded parameter in
the examples below):
{{q3abox.jpg}} gives the image as is
http://wiki.splitbrain.org/_media/q3abox.jpg
{{q3abox.jpg?150}} gives a proportional scaled image
http://wiki.splitbrain.org/_media/q3abox.jpg?w=150
{{q3abox.jpg?150x150}} gives an unproportional scaled image
http://wiki.splitbrain.org/_media/q3abox.jpg?w=150&h=150
Now the new URL gives a cropped and scaled image:
http://wiki.splitbrain.org/_media/q3abox.jpg?w=150&h=150&crop=1
When using cropping, the image is first cropped to the largest possible
part having the final aspect ratio, then the cropped image is scaled to
the wanted size.
The question is now what syntax to use for cropping. I have three ideas:
a) drop the unproportional scaling and always crop when both, width
**and** height are given.
This would affect existing pages using the scaling, but the result
would be most probably better than before.
{{q3abox.jpg?150x150}}
b) use an uppercase X to indicate cropping is wanted
This is not very obvious when reading the page but a clean, simple and
fast to write syntax
{{q3abox.jpg?150X150}}
c) add a crop parameter to the syntax
Uglyfies the syntax a bit but is clear what it does when reading
{{q3abox.jpg?150x150&crop}}
A combination of a) and c) is also possible: use cropping by default
and use uppercase X for rare cases of wanted unproportional scaling.
This is my current preference.
What do you all think? What would you prefer?
Andi
--
splitbrain.org
|

|