Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>IMGKIT reqiured css with absolute url for any background image or other assets. So you can generate it dynamically following this link <a href="https://coderwall.com/p/exj0ig" rel="nofollow">https://coderwall.com/p/exj0ig</a> and some steps as</p> <p><strong>A)</strong> Put your all images in assets/images folder of rails app</p> <p><strong>B)</strong> Install gem 'sass-rails' if not install <a href="https://github.com/rails/sass-rails" rel="nofollow">https://github.com/rails/sass-rails</a></p> <p><strong>C)</strong> create another css file name as css_file_name.css.sccs.erb</p> <p><strong>D)</strong> put your all other css file content in it.</p> <p><strong>E)</strong> In css file just put your image file name as below: background-image: image-url('image.png');</p> <p><strong>F)</strong> Use assets pipline (<a href="http://guides.rubyonrails.org/asset_pipeline.html#how-to-use-the-asset-pipeline" rel="nofollow">http://guides.rubyonrails.org/asset_pipeline.html#how-to-use-the-asset-pipeline</a>) Run below command as your app mode: (1) Development Mode: RAILS_ENV=development bundle exec rake assets:precompile (2) Production Mode: RAILS_ENV=production bundle exec rake assets:precompile</p> <p><strong>G)</strong> In your config/environments/</p> <p>(1) In development.rb config.action_controller.asset_host = "YOUR LOCAL HOST URL i.e YOUR_LOCALHOST_ADDRESS"</p> <p>(2) In production.rb config.action_controller.asset_host = "<a href="http://assets.example.com" rel="nofollow">http://assets.example.com</a>" /<em>YOUR ADDRESS</em>/</p> <p><strong>H)</strong> And last relate your stylesheet with IMGKIT as below</p> <pre><code>html_content = "YOUR HTML CONTENT" kit = IMGKit.new(html_content, height: 900, transparent:true, quality:10) /*YOUR SETTING*/ kit.stylesheets &lt;&lt; "#{Rails.root}/public/assets/application.css" file = kit.to_file(Rails.root + "public/pngs/" + "screenshot.png") /*YOUR IMAGE NAME*/ send_file("#{Rails.root}/public/pngs/screenshot.png", :filename =&gt; "screenshot.png", :type =&gt; "image/png",:disposition =&gt; 'attachment',:streaming=&gt; 'true') /*YOUR ADDRESS WHERE U WANT TO STORE PNG FILE*/ </code></pre> <p><strong>I)</strong> Restart server and enjoy!!!!!</p> <p>[<strong>NOTE:</strong> After every changes please run assets pipline command to get latest application.css which is made from .sccs.erb extension file.]</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload