Module: ChunkyPNG::Canvas::DataUrlExporting
- Included in:
- ChunkyPNG::Canvas
- Defined in:
- lib/chunky_png/canvas/data_url_exporting.rb
Overview
Methods to export a canvas to a PNG data URL.
Instance Method Summary collapse
-
#to_data_url ⇒ String
Exports the canvas as a data url (e.g. data:image/png;base64,<data>) that can easily be used inline in CSS or HTML.
Instance Method Details
#to_data_url ⇒ String
Exports the canvas as a data url (e.g. data:image/png;base64,<data>) that can easily be used inline in CSS or HTML.
10 11 12 |
# File 'lib/chunky_png/canvas/data_url_exporting.rb', line 10 def to_data_url ["data:image/png;base64,", to_blob].pack("A*m").delete("\n") end |