07-08-2007, 11:04 AM
[eluser]David Cassidy[/eluser]
Introduction
The purpose of the gravatar helper is to help you quickly and easily implement gravatars on your own website by constructing the URI that is necessary to display the user's gravatar.
This simple guide will assist you in installing the gravatar helper as well as illustrate its use.
Installation
1. Unpack the contents of the archive to an easily accessible directory, leaving the path names intact.
2. Copy the contents of the upload directory to your web server where CodeIgniter is installed, taking special care to preserve the directory structure.
Usage
Using the gravatar helper in your applications is very simple and straightforward. To begin using it, add the following code to your controller:
Next, add the following bit of code to your view where you would like to display the gravatar:
The above, will load the gravatar for the specified email address. Optionally, you may want to specify some additional parameters to impose limitations on the gravatar image.
Rating
Defines a maximum rating for the image's content. If the owner has flagged the image with a rating higher than that specified, the default image will instead be used. Acceptable values are G, PG, R, or X.
Size
Defines the desired height and width of the image in pixels, with acceptable values being between 1 and 80. Specifying a size smaller than 80 will result in the original gravatar image to be down-sampled using bicubic resampling before output.
Default
The default parameter allows you to specify the URL to an image that will be used as the default if the query fails to locate a gravatar for the given email address. Additionally, if a user's gravatar exceeds the rating limit defined by the "rating" parameter, this is the image that will instead be shown.
Below is an example illustrating the use of these optional parameters.
In turn, the results would be:
Typically, you should use the examples above to construct an <IMG> element to display a user's gravatar like so:
Changelog
Version 1.0
Release Date: Wednesday, August 08, 2007
* Reformulated code to generate URLs only, omitting the markup.
* Created user documentation.
Version 1.0 Beta
Release Date: Sunday, July 08, 2007
Download
Unix/Linux Users:
ci_helper_gravatar-1.0.tar.gz
Windows Users:
ci_helper_gravatar-1.0.zip
Introduction
The purpose of the gravatar helper is to help you quickly and easily implement gravatars on your own website by constructing the URI that is necessary to display the user's gravatar.
This simple guide will assist you in installing the gravatar helper as well as illustrate its use.
Installation
1. Unpack the contents of the archive to an easily accessible directory, leaving the path names intact.
2. Copy the contents of the upload directory to your web server where CodeIgniter is installed, taking special care to preserve the directory structure.
Usage
Using the gravatar helper in your applications is very simple and straightforward. To begin using it, add the following code to your controller:
Code:
$this->load->helper( 'gravatar' );
Next, add the following bit of code to your view where you would like to display the gravatar:
Code:
<?php echo gravatar( "[email protected]" ); ?>
The above, will load the gravatar for the specified email address. Optionally, you may want to specify some additional parameters to impose limitations on the gravatar image.
Rating
Defines a maximum rating for the image's content. If the owner has flagged the image with a rating higher than that specified, the default image will instead be used. Acceptable values are G, PG, R, or X.
Size
Defines the desired height and width of the image in pixels, with acceptable values being between 1 and 80. Specifying a size smaller than 80 will result in the original gravatar image to be down-sampled using bicubic resampling before output.
Default
The default parameter allows you to specify the URL to an image that will be used as the default if the query fails to locate a gravatar for the given email address. Additionally, if a user's gravatar exceeds the rating limit defined by the "rating" parameter, this is the image that will instead be shown.
Below is an example illustrating the use of these optional parameters.
Code:
<?php echo gravatar( "[email protected]", "PG", "40", "http://www.domain.com/default.gif" ); ?>
In turn, the results would be:
Code:
http://gravatar.com/avatar.php?gravatar_id=0ee5f81c11737062773c780c611ab0d5&rating=PG&size=40&default=http://www.domain.com/default.gif
Typically, you should use the examples above to construct an <IMG> element to display a user's gravatar like so:
Code:
<img src="<?php echo gravatar( "[email protected]" ); ?>" alt="Gravatar">
Changelog
Version 1.0
Release Date: Wednesday, August 08, 2007
* Reformulated code to generate URLs only, omitting the markup.
* Created user documentation.
Version 1.0 Beta
Release Date: Sunday, July 08, 2007
Download
Unix/Linux Users:
ci_helper_gravatar-1.0.tar.gz
Windows Users:
ci_helper_gravatar-1.0.zip