NAME

Mojolicious::Plugin::Gravatar - Globally Recognized Avatars for Mojolicious

SYNOPSIS

  # Mojolicious
  $self->plugin('gravatar'); 
  
  You can pass default size, rating, and default avatar url 
  $self->plugin('gravatar' => {
      size    => 60,   #default was 80
      rating  => 'X',  #default was PG
      default => 'http://example.com/default.png' # default was not value
      scheme  => 'https' # if omitted will look in request's url scheme.
  });

  # Mojolicious::Lite
  plugin 'gravatar';

  # Gravatars in templates
  <%= gravatar 'user@mail.com' %>
  will generate
  <img src="http://www.gravatar.com/avatar/6ad193f57f79ac444c3621370da955e9&amp;s=80&amp;r=PG" alt="Gravatar" height="80" width="80">

  <%= gravatar_url 'user@mail.com' %>  - if you need only url 
  
  Also you can overwrite any default config variables 
  <%= gravatar 'user@mail.com', size => 40, rating=> 'X' %>

  
  If you need some styling for img tag:
  <span class='gravatar'>  <%= gravatar $email %> </span>
  and describe in css - ".gravatar img {border: 1px solid white;}"
      

DESCRIPTION

This plugin adds gravatar ( http://gravatar.com ) helpers to your application.

CONFIG

default (optional)

The local (any valid absolute image URI) image to use if there is no Gravatar corresponding to the given email.

size (optional)

Gravatars are square. Size is 1 through 512 (pixels) and sets the width and the height.

rating (optional)

G|PG|R|X. The maximum rating of Gravatar you wish returned. If you have a family friendly forum, for example, you might set it to "G."

scheme (optional)

Gravatar URL scheme "http" or "https". If omitted will look in request's url scheme (if empty fill use "http").

HELPERS

gravatar $email [, %options ];

generate img tag for getting avatar from gravatar.com

$email (required) The key to using Gravatars is a hex hash of the user's email. This is generated automatically and sent to gravatar.com as the gravatar_id.

%options (optional) - you can override config parameters . Support all parameters that you have in config

example <img src="http://www.gravatar.com/avatar/6ad193f57f79ac444c3621370da955e9&amp;s=80&amp;r=PG" alt="Gravatar" height="80" width="80">

gravatar_url $email [, %options ];

generate url for getting avatar from gravatar.com

$email (required) The key to using Gravatars is a hex hash of the user's email. This is generated automatically and sent to gravatar.com as the gravatar_id.

%options (optional) - you can override config parameters . Support all parameters that you have in config

VERSION

Version 0.02

AUTHOR

Viktor Turskyi <koorchik@cpan.org>

CONTRIBUTORS

Nils Diewald (Akron)

BUGS

Please report any bugs or feature requests to bug-mojolicious-plugin-gravatar at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Mojolicious-Plugin-Gravatar. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

Also you can report bugs to Github https://github.com/koorchik/Mojolicious-Plugin-Gravatar/

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Mojolicious::Plugin::Gravatar

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

Copyright 2011 "koorchik".

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.