Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In haml, how do you output an inline image with a data:image / base64 data URI? #987

Closed
clarkewd opened this issue May 3, 2018 · 2 comments

Comments

@clarkewd
Copy link

clarkewd commented May 3, 2018

Setup:

I'm using the Signature Pad which has an option to convert a signature into a base64 encoded image.

This is what gets stored in the database:

data:image/png;base64,iVBORw0KGgoAAAANS

Outputting the tag in HAML:

I'm using haml with rails and to output the tag I've tried this:

%img{ src: signature_image_data }

But it outputs an escaped version:

<img src='&quot;data:image/png;base64,iVBORw0KGg

This works, but it's not very elegant:

=raw "<img src=#{ signature_image_data } />"

What's the "right" way to do this?

@dillonwelch
Copy link
Contributor

Are you able to provide a dummy app that reproduces the escaped image tag problem you're having with Signature Pad?

@k0kubun
Copy link
Member

k0kubun commented Dec 21, 2018

In %img{ src: signature_image_data }, signature_image_data seems to have " but it's wrong, right? It's not the matter of escaping it or not. Please check your signature_image_data implementation first.

Also closing this for inactivity of the original author.

@k0kubun k0kubun closed this as completed Dec 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants