TallTed
(Ted Thibodeau Jr)
6 Fevereiro , 2019 17:00
1
Quick image resizing and markdown image dimensions talked about the new “Ninja feature” to add ,25% for image scaling.
That’s great, if you know the percentage that results in the px you want, and if you have consistently sized or few embedded images.
It’s not so great if you have a number of images of somewhat varying original size and you want them all to scale to (for instance) 250px width.
Changing a number of such images from markdown to HTML markup is also painful.
Any chance this Ninja feature could be enhanced to accept % or px specifications for the scaling?
1 Curtiu
Falco
(Falco)
6 Fevereiro , 2019 17:36
2
Isso já é suportado:

produz
enquanto

produz
7 Curtiram
You can’t just specify the width though.
4 Curtiram
TallTed
(Ted Thibodeau Jr)
6 Fevereiro , 2019 18:04
4
I had misunderstood the meaning of the |250x190]. I thought that was meant to convey the size of the original, not that it was meant as a scaling.
(Is there one place to look to find documentation of all Markdown-for-Discourse?)
But yes, my wish here is to specify the width to scale to, and have the height be scaled proportionally.
3 Curtiram
sam
(Sam Saffron)
6 Fevereiro , 2019 23:27
5
I am pretty warm to adding support for:
|250x] and |x190] in fact I like this little bit of ninja so much that I will get the change slotted. @pmusaraj can you add this support?
14 Curtiram
pmusaraj
(Penar Musaraj)
8 Fevereiro , 2019 13:40
7
This is now done and in tests-passed.
10 Curtiram
sam
(Sam Saffron)
21 Fevereiro , 2019 04:40
9
I am having a bit of trouble with this…


1 Curtiu
pmusaraj
(Penar Musaraj)
21 Fevereiro , 2019 13:42
13
Hmm, this is set up to respond to this syntax  works:
I kept this consistent with percentage scaling, which responds to [image|300x100,50%].
1 Curtiu
TallTed
(Ted Thibodeau Jr)
21 Fevereiro , 2019 16:26
14
The percentage scaling ninja markup no longer makes mental sense to me.
[image|300x100,50%] says “show this image (actual size unknown), at 300px by 100px, but wait, scale that by 50%, so show it at 150px by 50px”.
I really don’t understand the point of this kind of notation – because you can just set the pixel sizing however you want it, so why not do the 50% scaling in the first place?
I do not want to specify one display size followed by a second display size, and cannot imagine why anyone would. I just want to say “show this image (of unknown original size) at 150px width, with proportionally scaled height” or “show this image (of unknown original size) at 150px height, with proportionally scaled width”.
2 Curtiram
snsnjsn
(Jianwei Li)
26 Outubro , 2019 06:34
15
A mesma pergunta que eu quero: apenas informe a imagem, com 200px de largura, e ignore a altura.
jord8on
(Jordan)
6 Fevereiro , 2020 01:09
16
Eu também gostaria disso.
Para recapitular, a sintaxe atual para dimensionar imagens (com espaços para melhor legibilidade) é:
! [ NOME_DA_IMAGEM | LARGURAxALTURA, PORCENTAGEM_ESCALA ] ( LOCAL_DA_IMAGEM )
Acho que seria excelente se pudéssemos dimensionar APENAS a LARGURA OU a ALTURA, inserindo a palavra AUTO para a dimensão correspondente.
Por exemplo: Digamos que eu queira que esta imagem tenha 150px de largura, mas não quero calcular a proporção para ajustar a altura à resolução correta…

Eu adoraria se pudéssemos substituir a LARGURA por 150 e a ALTURA por auto, da seguinte forma…

O que acham @Falco ?
sam
(Sam Saffron)
6 Fevereiro , 2020 01:19
17
Ainda acho que a proposta original é um pouco mais fácil de explicar.
Cole:

Depois edite para:

Isso funciona agora conforme explicado, mas é um pouco mais difícil de explicar:

@jord8on tudo isso já funciona, esta é a sintaxe que você procura:
[muito bom|250x190,150x]
4 Curtiram
jord8on
(Jordan)
6 Fevereiro , 2020 02:31
18
Ahhhhh @sam , obrigado pela redirecionamento. A funcionalidade atual está PERFEITA, se eu entendi corretamente agora.
Vamos ver se entendi isso direito…
“x” representa “auto”
se eu usar “x” antes do número, ele representará a largura. Ex: x150 = "width: auto; height: 150px;"
se eu usar “x” depois de um número, ele representará a altura. Ex: 150x = "width: 150px; height: auto;"
––––––––––––––––––––––––––––––––––––
Vamos testar isso com esta imagem que tem "width:600px; height: 200px;"
A sintaxe padrão de incorporação é:

que aparece como…
A seguinte imagem foi dimensionada para uma largura de 200px (altura = x = auto):

que aparece como:
A seguinte imagem foi dimensionada para uma altura de 100px (largura = x = auto):

que aparece como:
––––––––––––––––––––––––––––––––––––
Parece que está funcionando perfeitamente. Que bom ter entendido e agora poder usar isso!
Obrigado @sam pela resposta rápida!
9 Curtiram