Laravel-Backpack / basset

Better asset helpers for Laravel apps.
MIT License
151 stars 10 forks source link

[Feature Request] Support for SVGs and images #84

Closed tabacitu closed 10 months ago

tabacitu commented 11 months ago

What if you want to internalize an image or SVG from a third-party website? Wouldn't it be cool if we could do:

@basset('https://path/to/file.svg')

and it would output

<img src="https://local.app/path/to/internalized/file.svg">

Of course... we'd have to do that for all image types... right? 👀 What do you think @promatik ? Worth doing or not?

tabacitu commented 11 months ago

Maybe not as helpful to load images from CDNs. But you might want to load an img from a non-public directory, if you're a package, right? And not ask devs to publish their assets in order to get them.

tabacitu commented 11 months ago

@promatik mentioned this might open Pandora's box. If we start supporting image filetypes... what's next? And where do we stop? And he might be right.

After all, if we do https://github.com/Laravel-Backpack/basset/issues/83 there will be a way for ALL filetypes to use Basset... by defining the HTML element themselves and using the basset() helper alone. So that would be a solution too, I guess. And it's such an elegant solution that I'm pissed we hadn't thought of it ourselves, to be honest 😅

But let's entertain the idea a little bit longer. Let's crunch the numbers, see what's actually inside Pandora's box 😅


Here's a list of HTML elements that are commonly used to load external files, along with the attributes they use:

HTML Element Purpose Attribute Basset support
\ Githubissues.
  • Githubissues is a development platform for aggregating issues.