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

Is there a way to get ruby-graphviz to output to a base64 encoded image? #143

Closed
epasquali opened this issue Oct 8, 2019 · 1 comment
Closed

Comments

@epasquali
Copy link

I'm using ruby-graphviz inside a Ruby on Rails project (a web application). I'm generating my graph from a model and so far so good, but from what I understand the output method only enables me to generate the graph pictures as files.

This presents a problem for me because this means I first have to save the file, then serve it up again in the same action. This is inefficient and slow.

Ideally, I would like graphviz to output the resulting graph in some sort of string or base64 encoded format so that it wouldn't need to be saved in a file, just stored as a variable, and then I can call up that variable to display the graph in my view.

Is there a way to do that at the moment? I can't glean from the documentation if one can at the moment.

@epasquali
Copy link
Author

Ah nevermind. I realized you can do
.output(:png => String), and then I can base64 encode it with rails. So nevermind. Thx.

@glejeune glejeune closed this as completed Oct 8, 2019
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

2 participants