V
V
Vanya Petilo2021-09-18 22:09:43
css
Vanya Petilo, 2021-09-18 22:09:43

How to put png/jpg image as svg background?

Hello!
Really, really need help from very, very experts.
What is available: a design layout, two random photos from Yandex and no ideas.
What is required: substitute the images in the required places. In place of the red and green figures, see below.
6146381f326d3459812109.png

There are no issues with the green shape -- border-radius at 100% and ok. But what to do with the red uniform? Maybe somehow use a mask, svg, something else? I read a lot of information, but I'm either looking in the wrong place, or it's not right. The option to convert the image to base64 and put it inside the svg immediately into the firebox is too expensive to store the entire image in the database (instead of just a link to it), and all images will be stored in it.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Arseny, 2021-09-18
@mr_garther

For a complex shape, yes, an SVG mask, for a round shape, border-radius is enough. However, nothing prevents you from generating SVG directly in the HTML body. See the SVG specification for how to insert images into the body or as a background.

V
Vanya Petilo, 2021-09-19
@mr_garther

So, after a little rest and then returning to the markup and styles, I continued to shamanize and yet, I succeeded. Thanks to Arseniy Matytsin for confirming that there should be an SVG mask here.
For those who have also tried or who are interested, here is the markup and styles of the working version:

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question