Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 24 lines (13 sloc) 1.216 kb
5aa1031 Changed name from 'iconoclast' to 'iconoclasm'
Sander Hartlage authored
1 # iconoclasm
07cab08 Initial commit to iconoclast.
Sander Hartlage authored
2
fdde612 Wrote README
Sander Hartlage authored
3 Finds favorites icons for web pages on the world wide internets by checking the HTML head or the standard favicon location. Then, do with them what you will.
07cab08 Initial commit to iconoclast.
Sander Hartlage authored
4
5aa1031 Changed name from 'iconoclast' to 'iconoclasm'
Sander Hartlage authored
5 Called "iconoclasm" because there was already a gem on gemcutter called "iconoclast". Boo! Hiss!
6
fdde612 Wrote README
Sander Hartlage authored
7 ### Usage
07cab08 Initial commit to iconoclast.
Sander Hartlage authored
8
fdde612 Wrote README
Sander Hartlage authored
9 To get the favicon for a page, do:
07cab08 Initial commit to iconoclast.
Sander Hartlage authored
10
5aa1031 Changed name from 'iconoclast' to 'iconoclasm'
Sander Hartlage authored
11 `favicon = Iconoclasm.extract('www.website.com')`
fdde612 Wrote README
Sander Hartlage authored
12
13 This will go and do a bunch of GETs (two or three, actually) on the url given. If you've already got the content and want to skip one of the GETs, you can pass the content in as the second argument.
14
ddc5d1a Fixed (maybe) some formatting in README
Sander Hartlage authored
15 `content = get_some_content('www.website.com')`<br/>
5aa1031 Changed name from 'iconoclast' to 'iconoclasm'
Sander Hartlage authored
16 `favicon = Iconoclasm.extract('www.website.com', content)`
fdde612 Wrote README
Sander Hartlage authored
17
5aa1031 Changed name from 'iconoclast' to 'iconoclasm'
Sander Hartlage authored
18 `Iconoclasm.extract` returns an `Iconoclasm::Favicon` instance, from which you can get the URL, content type, size, or access the binary image data. By calling `valid?`, you can check if the favicon is valid based on whatever my standards were when I wrote this (basically, whether or not it's actually an image).
fdde612 Wrote README
Sander Hartlage authored
19
20 You can save the image to a tempfile using `favicon.save`, or more usefully, to a file at `favicon.save('path/to/file')`. Fun times had by all.
21
22 ## Copyright
23
24 Copyright (c) 2009 Sander Hartlage. See LICENSE for details.
Something went wrong with that request. Please try again.