ruby on rails - Displaying Png image using Barby Barcode generator -


i using barby , png outputter. have gotten compile fine, not sure how can display image. here code..

controller:

@barcode = barby::code128b.new(@num) @blob = barby::pngoutputter.new(@barcode).to_png #raw png data file.open('barcode.png', 'w'){|f| f.write @blob } 

application helper:

require 'barby' require 'barby/barcode/code_128' require 'barby/outputter/png_outputter' 

view:

<%= @blob %> 

since @blob image data, can't "print" regular string. need use image_tag instead, , give path image. like:

<%= image_tag("barcode.png") %> 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -