Module: Avataree::ImageServices

Includes:
Helper
Defined in:
lib/avataree/image.rb

Instance Method Summary collapse

Methods included from Helper

#get_params, included, #make_digest, #prepare_url_with_params, url_for_request

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: extension takes image type(e.g. jpg, png …) :default => jpg secure takes boolean values to use https or not :default => false 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 pixelated 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



51
52
53
54
55
56
57
# File 'lib/avataree/image.rb', line 51

def gravatar_image_path(email, options = {})
  email = make_digest(email)
  services_url = Helper.url_for_request(options.delete(:secure))
  email<<".#{options.delete(:extension)}" if options[:extension]
  resulted_path = [services_url, "avatar/", email].join("")
  prepare_url_with_params(resulted_path, options)
end