简体   繁体   中英

Listing png/jpg files as svg

I have a list of images. All svgs are perfectly formatted in the list and I learned that there is some way to create a svg code that contains jpgs/pngs. So I'd like to create the code for a svg Image that centers a jpg/png file. Is that possible?

If that wasn't clear enough here is some Pseudo of what I'm trying to do:

<img class="imgSizing" src={svgCentersPng} />

Since SVG is a text file, you could generate this (with a backend script like php) via parameters like "centerimage.svg?image=src/from/jpg". But why don't you just center the image using CSS?

With Flexbox this is just a piece of cake, see: https://css-tricks.com/snippets/css/a-guide-to-flexbox/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM