Skip to content

mruby mrmagick with Hibari

Junichi Kajiwara edited this page Oct 13, 2015 · 4 revisions
class HelloApp < Hibari::App
  def build
  
	img = Mrmagick::ImageList.new("./examples/h2o_mruby/sample.jpg") # read image file.
	p1 = req.params['p'].to_f
	new_img = img.blur_image(0.0, p1) # returns new image which bluerd.
	msg = new_img.to_blob
	
	res.code = 200
    res.headers["content-type"] = "image/jpeg;"
    res.body.push("#{msg}")
    
  end
end

HelloApp.new.run

If you are using H2O with default settings

https://127.0.0.1:8081/a?p=3

Link