Image within SVG

I am starting to play with SVGs and what has me stuck at the moment is being able to display a jpg or png image inside an svg circle in appsheet.
Outside of appsheet I have achieved it without problems in the following way:
Circle and imagen

<svg xmlns='https://www.w3.org/2000/svg' width='100%' height='100%' viewBox='0 0 40 40'> 
<defs>
<pattern id='foto' patternUnits='userSpaceOnUse' width='100' height='100'>
<image href=https://drive.google.com/uc?export=view&id=1sF7SR0Oi25OTSqC45yyPaBvQiEE3peQs x='0' y='0' width='100%' height='100%' />
</defs>
<style>
.circulo {
stroke: #305059;
}
</style>
<circle class='circulo' cx='20' cy='20' r='16' stroke-width='1' fill='url(#foto)'> </circle>
</svg>



In general, I don't have a problem displaying svgs in appsheet, but I'm having a hard time displaying the images inside SVGs in appsheet

Circle in appsheet 

"data&colon;image/svg+xml;utf8,"&ENCODEURL("<svg xmlns='http://www.w3.org/2000/svg' width='100%' height='100%' viewBox='0 0 40 40'>

<circle class='rail' cx='20' cy='20' r='16' stroke='black' stroke-width='1' fill='transparent'> </circle>
</svg>")


Circle and image in appsheet ??

"data&colon;image/svg+xml;utf8,"&ENCODEURL(CONCATENATE("<svg xmlns='https://www.w3.org/2000/svg' width='100%' height='100%' viewBox='0 0 40 40'> 
<defs>
<pattern id='foto' patternUnits='userSpaceOnUse' width='100' height='100'>
<image href=",[Foto]," x='0' y='0' width='100%' height='100%' />
</defs>
<style>
.circulo {
stroke: #305059;
}
</style>
<circle class='circulo' cx='20' cy='20' r='16' stroke-width='1' fill='url(#foto)'> </circle>
</svg>"))

 I have tried a few different ways but still no success

Solved Solved
0 7 3,996
1 ACCEPTED SOLUTION

I think for images with Base64 characters string exceeding 50,000 characters, you could use concatenation in two or three columns of Base 64 characters. I think @Kirk_Masden had mentioned this approach of  concatenation.

For me, I could convert a fairly detailed image into Base64 within 50,000 limit. For example, the following Image took around 29,000 characters to convert a .JPEG to Base 64.  The JPEG image was 512 X 512 pixels. I believe you may look into the image pixel size you are trying to convert.  I also believe you may need some experimentation as well. 

Finally, I think SVG images are best used as logos, icons ( the way we have icons in AppSheet for actions ) etc. and not for very detailed images. If you see tips on SVGs, they have such approach of using SVGs for icons etc.

The text "Kingfisher" is overlay on the image .It is populated with a variable based on another text column that contains names from the same record.

Suvrutt_Gurjar_0-1684039315287.png

 

 

 

 

View solution in original post

7 REPLIES 7