statamic / v2-hub

Statamic 2 - Feature Requests and Bug Reports
https://statamic.com
95 stars 5 forks source link

Glide tag to work with SVG #872

Open wojtiku opened 8 years ago

wojtiku commented 8 years ago

It would be great if the glide tag worked with SVG images - it would simply have to ignore them and just print the url without included transformations. The problem is that now I am forced to use either SVG images or any other on the field or do some crazy if/else magic in the templates because trying to reference an SVG image in the glide tag simply prints an empty string.

andypillip commented 8 years ago

I'd support that.

The control panel also should offer a preview for SVG images.

It could be one of the fist CMS to provide that feature – it's just common to work with SVG, and yet almost no CMS supports previews for SVG.

allanwhite commented 8 years ago

Having Assets preview them would be nice.

Been doing lots of SVG work lately, and of course there's many ways to use them. In spite of being able to use them within an img tag, they are fundamentally different in so many ways.

What might be useful is a way to treat them as code (with a visual preview) and have them inlined in the template output, so CSS can act upon them more easily. Perhaps a flag somewhere.

In any case, treating them like a different media type within the Assets universe makes sense.

jasonvarga commented 8 years ago

You got it, guys. Don't worry, this'll get done.

An svg isn't an "image" as recognized by Glide, that's why you need to do the crazy conditions - which is obviously annoying. I like the idea of it just passing right through so you can avoid that.

dannyuk1982 commented 7 years ago

Could do this this, current site has a load of SVGs and they all look like this:

screen shot 2016-12-01 at 12 11 02

Just an SVG icon would be fine - anything so it doesn't show the broken image icon.

anvart commented 6 years ago

Same problem, but we're solving it with

{{ if pic | extension == 'svg' }}
  <img src="{{ pic }}">
{{ else }}
  ... glide ...
{{ /if }}

But SVG's are not shown anywhere in admin except asset browser. We're going to fix it by adding <base href="{!! SITE_ROOT !!}">, so my question is about the base tag. Checked the docs but found nothing about it. Is there any chance for devs to add base to admin pages? That would be a solution for mostly all the previews, except for replicator section headers.