Not logged in. · Lost password · Register
Forum: General Help and Support Syntax and Usage RSS
Feature Request - Inserting images at a given scale
Avatar
mforkel #1
Member since Jun 2007 · 98 posts
Group memberships: Members
Show profile · Link to this post
Subject: Feature Request - Inserting images at a given scale
As described here, the display size of included images can be specified as width or width plus height. I usually want to insert images, e.g. screenshots, at the same scale, not a the same size. In order to do that , I have to first  look up the original size of each image and then calculate its scaled width.

I would like to suggest to extend DokuWiki's syntax for image insertion by a scaled value, i.e. in percentage of the original size. This might look like
{{wiki:dokuwiki-128.png%50}}
to display the image at half its original size.
This post was edited on 2018-08-09, 18:40 by mforkel.
Avatar
LarsDW223 #2
Member since Sep 2014 · 272 posts · Location: Paderborn
Group memberships: Members
Show profile · Link to this post
The units for the size can be relative and do not have to be pixels. E.g. you can specify a percentage value. Try out this examples:

{{wiki:dokuwiki-128.png?50%}}
{{wiki:dokuwiki-128.png?200%}}
Avatar
mforkel #3
Member since Jun 2007 · 98 posts
Group memberships: Members
Show profile · Link to this post
I like your syntay much better than the one I suggested. unfortunately, it does not work for me with release 2018-04-22a "Greebo". And I can't find it in the wiki syntax. May be you are using some clever plugin?
This post was edited on 2018-08-09, 20:16 by mforkel.
Avatar
LarsDW223 #4
Member since Sep 2014 · 272 posts · Location: Paderborn
Group memberships: Members
Show profile · Link to this post
Hmmm...I did not use a plugin. I also use DokuWiki Greebo. Tested with Firefox. Which browser do you use?
Avatar
mforkel #5
Member since Jun 2007 · 98 posts
Group memberships: Members
Show profile · Link to this post
My browser is Firefox 61.0.2 on Windows.

And you are right: I now tried your examples and the DokuWiki icons are rendered at 50% and 200%.

But I ran my test with a screenshot image created and inserted by the ImgPaste Plugin. The image is in PNG format as well, just a little larger (802 by 606).
{{windows:windows_10:20180809-111538.png?50%}}
And that still does not scale, but looks like it might be 50 pixels in width.

So what is making the difference?
Avatar
LarsDW223 #6
Member since Sep 2014 · 272 posts · Location: Paderborn
Group memberships: Members
Show profile · Link to this post
I tested inserting the DokuWiki image with the ImgPaste plugin and it still scales if I append ?50% to the generated image link. So I assume it must have something to do with your image file.
Avatar
mforkel #7
Member since Jun 2007 · 98 posts
Group memberships: Members
Show profile · Link to this post
Nope, not here, unfortunately.

I looked at the source for the icons that seem to scale:
<p>
<a href="/dokuwiki/_detail/wiki/dokuwiki-128.png?id=sandbox" class="media" title="wiki:dokuwiki-128.png"><img src="/dokuwiki/_media/wiki/dokuwiki-128.png?w=50&amp;tok=fe8923" class="media" alt="" width="50"></a>
</p>

<p>
<a href="/dokuwiki/_detail/wiki/dokuwiki-128.png?id=sandbox" class="media" title="wiki:dokuwiki-128.png"><img src="/dokuwiki/_media/wiki/dokuwiki-128.png" class="media" alt=""></a>
</p>

<p>
<a href="/dokuwiki/_detail/wiki/dokuwiki-128.png?id=sandbox" class="media" title="wiki:dokuwiki-128.png"><img src="/dokuwiki/_media/wiki/dokuwiki-128.png?w=200&amp;tok=d201d3" class="media" alt="" width="200"></a>
</p>
The icon's width is 128 pixels. So I guess what looks like percentual scaling is actually just a change of width that feels about right. Try to display your screenshot at 100% (i.e. with '?100%') and without scaling. Assuming it's significantly smaller or wider than 100 pixels, you should see the difference.
Avatar
LarsDW223 #8
Member since Sep 2014 · 272 posts · Location: Paderborn
Group memberships: Members
Show profile · Link to this post
Ahh...sorry - you are right.

I had a look at the DokuWiki source code. Right now scaling with relative percentage values is not possible. Also I was wrong with my assumption that the HTML image tag allows percentage values, see https://www.w3schools.com/tags/tag_img.asp.

So this would require a change in DokuWiki. Maybe you like to post a feature request at github.
Avatar
mforkel #9
Member since Jun 2007 · 98 posts
Group memberships: Members
Show profile · Link to this post
I have written Feature Request: Display images at a given scale at GitHub.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
Imprint
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2018-08-21, 01:18:52 (UTC +02:00)