README.md in imgkit-0.9.2 vs README.md in imgkit-1.0.0

- old
+ new

@@ -1,9 +1,11 @@ # IMGKit Create JPGs using plain old HTML+CSS. Uses [wkhtmltoimage](http://github.com/antialize/wkhtmltopdf) on the backend which renders HTML using Webkit. +Heavily based on [PDFKit](http://github.com/jdpace/pdfkit/). + ## Install ### IMGKit gem install imgkit @@ -19,14 +21,14 @@ # IMGKit.new takes the HTML and any options for wkhtmltoimage # run `wkhtmltoimage --extended-help` for a full list of options kit = IMGKit.new(html, :quality => 50) kit.stylesheets << '/path/to/css/file' - # Get an inline image + # Get the image BLOB img = kit.to_img - # Save the PDF to a file + # Save the JPG to a file file = kit.to_file('/path/to/save/file.jpg') # IMGKit.new can optionally accept a URL or a File. # Stylesheets can not be added when source is provided as a URL of File. kit = IMGKit.new('http://google.com') @@ -35,27 +37,29 @@ # Add any kind of option through meta tags IMGKit.new('<html><head><meta name="imgkit-quality" content="75") ## Configuration -If you're on Windows or you installed wkhtmltopdf by hand to a location other than /usr/local/bin you will need to tell PDFKit where the binary is. You can configure PDFKit like so: +If you're on Windows or you installed wkhtmltoimage by hand to a location other than /usr/local/bin you will need to tell PDFKit where the binary is. You can configure PDFKit like so: # config/initializers/imgkit.rb IMGKit.configure do |config| config.wkhtmltoimage = '/path/to/wkhtmltoimage' config.default_options = { :quality => 60 } end -## Mime Types +## Rails + +### Mime Types register a .jpg mime type in: #config/initializers/mime_type.rb Mime::Type.register "image/jpeg", :jpg -## Controllers +### Controller Actions You can then send JPGs with format.jpg do send_data(@kit.to_img, :type => "image/jpeg", :disposition => 'inline') end