Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add examples to the gem.

  • Loading branch information...
commit 81edb02d8d8b62d0a660b3fc1488d139f9713ed0 1 parent 189b3cb
toxboe authored March 21, 2012

Showing 1 changed file with 37 additions and 2 deletions. Show diff stats Hide diff stats

  1. 39  README.md
39  README.md
Source Rendered
@@ -3,8 +3,43 @@ PeepShot
3 3
 
4 4
 Provides rails helpers for interfacing with [PeepShot](http://peepshot.com).
5 5
 
6  
-Example
7  
--------
  6
+Examples
  7
+--------
  8
+
  9
+PeepShot can be integrated into your Rails application in two ways:
  10
+
  11
+### Use the PeepShot image tag helper: peepshot_image_tag(url, options)
  12
+
  13
+The minimum requirements for the peepshot_image_tag is an url and a width. When no height is given, PeepShot will return an un-cropped screenshot of the full page. The following example will return an 320px wide image with a height above 1000px.
  14
+
  15
+    <%= peepshot_image_tag("http://ui-patterns.com", :width => 450) %>
  16
+
  17
+Will return something like this:
  18
+
  19
+    <img alt="Ui-patterns" src="http://api.peepshot.com/v1/0d03a6bc89/d06c16f085ceba605b5294126517d03a/450?url=http://ui-patterns.com" width="450" />
  20
+
  21
+The maximum width of a screenshot is 1024 pixels.
  22
+
  23
+Adding a height to the options hash will make PeepShot crop the screenshot with basis in the top left corner.
  24
+
  25
+    <%= peepshot_image_tag("http://ui-patterns.com", :width => 450, :height => 337) %>
  26
+
  27
+Will return something like this:
  28
+
  29
+    <img alt="Ui-patterns" height="337" src="http://api.peepshot.com/v1/0d03a6bc89/d06c16f085ceba605b5294126517d03a/450x337?url=http://ui-patterns.com" width="450" />
  30
+
  31
+You can add any HTML options you'd like as you would with a regular image_tag in rails:
  32
+
  33
+    <%= peepshot_image_tag("http://ui-patterns.com", :width => 450, :height => 337, :class => 'thumbnail', :alt => "Go to UI-Patterns.com") %>
  34
+
  35
+### Use the PeepShot url helper: peepshot_url(url, options)
  36
+
  37
+If you'd like to use peepshot in your own homebrewn way, you can skip the image tag, and just get the URL for the thumbnail:
  38
+
  39
+    peepshot_url("http://ui-patterns.com", :width => 320)
  40
+
  41
+Installation
  42
+------------
8 43
 
9 44
 Prerequisite: You need a peepshot.com account. Have your API Key and API Secret handy.
10 45
 

0 notes on commit 81edb02

Please sign in to comment.
Something went wrong with that request. Please try again.