Module: Avataree::Image
- Includes:
- Helper
- Defined in:
- lib/avataree/image.rb
Constant Summary collapse
- IMAGES_PATH =
image path for gravatar if not defined?
"http://www.gravatar.com/avatar/"
Instance Method Summary collapse
-
#gravatar_image_path(email, options = {}) ⇒ Object
(also: #gravatar)
this method returns resulted path to be requested to gravatar.
Methods included from Helper
Instance Method Details
#gravatar_image_path(email, options = {}) ⇒ Object Also known as: gravatar
this method returns resulted path to be requested to gravatar. takes all argument as a hash options: s or size takes size in px (upto 512 px) :default => 80px x 80px d or default takes default image. Also takes a url other options are:
404: do not load any image if none is associated with the email hash, instead return an HTTP 404 (File Not Found) response
mm: (mystery-man) a simple, cartoon-style silhouetted outline of a person (does not vary by email hash)
identicon: a geometric pattern based on an email hash
monsterid: a generated 'monster' with different colors, faces, etc
wavatar: generated faces with differing features and backgrounds
retro: awesome generated, 8-bit arcade-style faces
f or forcedefault takes y and n as argument :default => n r or rating takes below mentioned options as argument
g: suitable for display on all websites with any audience type.
pg: may contain rude gestures, provocatively dressed individuals, the lesser swear words, or mild violence.
r: may contain such things as harsh profanity, intense violence, nudity, or hard drug use.
x: may contain hardcore sexual imagery or extremely disturbing violence.
in addition to these it also takes extension as options that lets you define the image type you want. extension default => jpg
52 53 54 55 56 57 58 |
# File 'lib/avataree/image.rb', line 52 def gravatar_image_path(email, = {}) email = make_digest(email) email<<".#{options[:extension]}" and .delete(:extension) if [:extension] params = .to_param unless .empty? resulted_path = IMAGES_PATH.dup << email [resulted_path, params].compact.join("?") end |