Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running phantomjs from a Ruby on Rails application

I'm interested in using Phantomjs and I'd like to run it from my Ruby on Rails application. However, this is a command line tool (i.e. I'd need to run something like phantomjs rasterize.js http://raphaeljs.com/polar-clock.html clock.png in my terminal). How would I execute a command line tool from my app?

like image 736
Justin Meltzer Avatar asked Jun 22 '11 17:06

Justin Meltzer


1 Answers

Use backticks in your ruby code e.g.:

output = `phantomjs rasterize.js http://raphaeljs.com/polar-clock.html clock.png`
like image 58
Matt Avatar answered Sep 18 '22 21:09

Matt