cloudinary-vue icon indicating copy to clipboard operation
cloudinary-vue copied to clipboard

Add the possibility to deliver raw svg

Open blaadje opened this issue 3 years ago • 3 comments

Explain your use case

I'd like to use <CldImage /> component with svg and not retrieving rendered <img /> tag but <svg />

Describe the problem you’re trying to solve

So we can control styling in css such as stroke fill etc. & use cloudinary with svg as hosting only. (no transforms)

Do you have a proposed solution?

Modify Image component api

blaadje avatar Sep 15 '21 09:09 blaadje

Hey @blaadje

You can use the https://github.com/cloudinary/cloudinary_js package to use plain javascript (Without vue), and use the results wherever you want.

The next generation of the javascript SDK will be released shortly, and can be used as well: https://github.com/cloudinary/js-url-gen

This feature is currently out of scope for the Vue SDK itself.

patrick-tolosa avatar Sep 15 '21 11:09 patrick-tolosa

Hello @patrick-tolosa , thanks for your answer ! Could you give me an example to do this ? I cannot find anything in the doc close to that :(

blaadje avatar Sep 15 '21 13:09 blaadje

The key thing to consider is the separation of concerns, the first task is to create a URL with your desired transformation

Once you created your URL, you can use it in whatever element you want. your custom image element, an SVG, a CSS background (using javascript to inject the CSS), or anything else.

patrick-tolosa avatar Sep 19 '21 11:09 patrick-tolosa