我正在寻找一种方法将html标签转换为动态图像......
这意味着,我希望能够创建一个image_tag,其中包含一个返回从html创建的图像的方法的路径.
我正在寻找解决方案,但无法找到解决问题的正确方法......
有任何想法吗?
Maechi
我正在使用imgkit我的网页快照.我跑:
RAILS_ENV=production bundle exec rake assets:precompile 预编译我的资产.
app/assets目录的所有文件都编译为public/assets
application.css编译为application-7a23a105125768e41d9d24aee4553615.css.
我的控制器代码是:
kit = IMGKit.new(render_to_string(:partial => 'form', :height => 200, :transparent => true, :quality => 10, :layout => false,:locals => {:project => @project}))
# t = kit.to_img(:png)
kit.stylesheets << "#{Rails.root.to_s}/public/assets/application.css"
#file = kit.to_file(Rails.root + "public/pngs/" + "screenshot.png")
file = kit.to_file(Rails.root + "public/assets/" + "screenshot.png")
#send_file("#{Rails.root.to_s}/public/pngs/screenshot.png", :filename => "screenshot.png", :type => "image/png",:disposition => 'attachment',:streaming=> 'true')
Run Code Online (Sandbox Code Playgroud)
我不知道怎么解决/public/assets/application.css没找到错误...
没有这样的文件或目录 - public/assets/application.css
我正在使用https://github.com/csquared/IMGKit/issues/36获取css并在我的快照中工作
编辑
def …Run Code Online (Sandbox Code Playgroud)