1
Eae Personal, I’m having a difficulty, I’m wanting to put an image inside my svg but I can’t, someone could help me ?
Follows my code:
<svg version="1.0"
xmlns="http://www.w3.org/2000/svg"
width="988.000000pt"
height="570.000000pt"
viewBox="0 0 988.000000 570.000000"
preserveAspectRatio="xMidYMid meet"
id="{{ pillar }}">
<defs>
<pattern id="imgPillar02" x="0" y="0" height="1" width="1">
<image width="100%" xlink:href="https://i.stack.imgur.com/KKm5N.jpg"></image>
</pattern>
</defs>
<g transform="translate(0.000000,570.000000) scale(0.100000,-0.100000)"
fill="url(#imgPillar02)">
<path d="M856 4834 l-859 -862 209 -224 c114 -122 285 -304 379 -403 277 -293
319 -338 357 -385 20 -25 85 -94 144 -155 93 -96 257 -271 923 -985 79 -85
226 -243 325 -350 100 -107 246 -265 326 -350 80 -86 194 -209 255 -275 60
-66 150 -163 200 -215 50 -52 136 -144 190 -204 55 -61 123 -133 150 -162 28
-28 67 -71 88 -95 20 -24 62 -72 94 -107 l56 -62 3094 0 3093 0 0 2850 0 2850
-4082 -1 -4083 -2 -859 -863z"/ stroke="red" stroke-width="20" fill="url(https://i.stack.imgur.com/KKm5N.jpg)">
</g>
</svg>
I appreciate the help!
Dear Hugo, Fill can go on
<g>
, so much so that if there is more than one element in the group they will inherit "Fill", which makes it much easier (if it is the intention) to add the same Fill in several elements, for example: https://codepen.io/brcontainer/pen/PoYXoeE– Guilherme Nascimento
@Guilhermenascimento very interesting! I had no idea it would work this way! I will correct in the answer :)
– hugocsl
You can copy the entire example to the stacksnippet if you want :)
– Guilherme Nascimento
@Guilhermenascimento is there, thanks to the tip. I just haven’t figured it out yet because I couldn’t render the image in the path/g of its code and had to redo the path to work :/
– hugocsl
I haven’t looked at his code yet, I’ll take it easy, if it’s something simple I’ll comment to you and you edit the answer adding details.
– Guilherme Nascimento
@Guilhermenascimento nada, ai vc posta a reply Hi, I know you will have much more to add :D SVG is still a little obscure for me. I wanted a book in preference to study it
– hugocsl
I found out, it was what I suspected, the area that corresponds to his Fill are just "lines", the middle part of it is "leaked", so it won’t work in his code, ie the outline is actually the area and the middle has nothing, problem in his path.
– Guilherme Nascimento
@Guilhermenascimento is just that, by the amount of points of the vector already gives to have an idea, and as the stocke of 20 was to have become much thicker the line tb. But the strange thing is that if you put a solid color Fill like
fill="green"
his svg is thus filled... http://prntscr.com/p926rc– hugocsl
Aaah got it, thank you so much for your help, it worked :)
– Felipe Godoy
Dear Hugo, it really is not at the ends, the problems is how the points are "connected", it seems that there is more than one path, but in fact it is how they are interconnected, as if they change direction (totally the other way around) the tip of the house, looking even a "folding", see the result with the same path as it: https://codepen.io/brcontainer/pen/oNvJZmd
– Guilherme Nascimento