Hello guys, I would like to put values not in pixels (px) but in percentages (%) in the dynamic component of an image. NOTE: I don’t use extensions, I use the dynamic image tool found in the dynamic components section.
Usually components where you can change the height and width through properties will have properties named under…
- HeightPercent
- WidthPercent
Changing those properties with the extension is simple and there is no need for the % symbol. Enter the number you’d like and that’s all!
As a default app will save as px whenevr you add values. That time use %
i.e do not use number alone as 3
Use number and symbol as 3%
0.1 means 1%, 0.2 means 2%, 0.3means 3%,…1 means 100%
???
Pixels is different from percent, its not making decimal.
On HeightPercent and WidthPercent you should imput simply 50 for 50%
Extension to get percentage from pixel height or width of component
Basically, it’s just a calculation of the percentage of the width or height of the pixel times the percentage you want it to be and returns the pixel value of that percentage.
You can do that yourself though, there’s no need to use an extension… just do height (or width) × (percent as decimal without symbol) and you get the result?
yes … of course…
example.
width = 360px
in percent 360px = 100%
if you want to make it 50%,
then 50x360:100 = 180px = 50% of the width.
You can change it as you like.