开发者

Running phantomjs from a Ruby on Rails application

开发者 https://www.devze.com 2023-03-15 04:25 出处:网络
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://r

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 comman开发者_高级运维d line tool from my app?


Use backticks in your ruby code e.g.:

output = `phantomjs rasterize.js http://raphaeljs.com/polar-clock.html clock.png`
0

精彩评论

暂无评论...
验证码 换一张
取 消