inline_svg icon indicating copy to clipboard operation
inline_svg copied to clipboard

Display from Active Storage

Open richjdsmith opened this issue 3 years ago • 5 comments

I have disabled Active Storage from displaying the image as a blob by adding an initializer with the following:

Rails.application.config.active_storage.content_types_to_serve_as_binary.delete('image/svg+xml')

However, I am still unable to do something like the following <%= inline_svg_tag product.product_icon, class: 'h-6 w-6', aria: { hidden: true } %> without an error being thrown. Not entirely sure what I am doing wrong.

richjdsmith avatar Nov 04 '22 06:11 richjdsmith

Could you paste in the error you're seeing? 🤔

jamesmartin avatar Mar 29 '23 21:03 jamesmartin

@richjdsmith Did you get it to work?

elalemanyo avatar Jun 28 '23 08:06 elalemanyo

Same thing happening here. If I use url_for(user.avatar) I get the empty SVG with the file not found error (and the path it shows is actually correct); if I just do user.avatar I get undefined method 'start_with?' for #<ActiveStorage::Attached::One:0x000000010cc8d540>.

Any ideas?

diniscorreia avatar Jul 17 '23 15:07 diniscorreia

@richjdsmith Did you get it to work?

Nope. Implemented a dirty fix myself, but never did love how I did it. If I have time I'll track it down and try to do a pull request.

richjdsmith avatar Aug 08 '23 17:08 richjdsmith

@richjdsmith did you manage to track down your dirty fix? Would be good to see how you've done it at least

simmerz avatar Apr 29 '24 13:04 simmerz