Coder Social home page Coder Social logo

gravatar-php-class's Introduction

Gravatar PHP Class (PHP5)

A Gravatar class that interacts with the Gravatar API to retrieve images specified by the owner of the e-mail address on http://gravatar.com/ or a generated default if no e-mail address or image can be found.

Requirements

  1. PHP 5.3+

Documentation

Using this Gravatar class is incredibly simple and very easy to use. When using the class we only require a call to one static method what requires one parameter.

All we require, is an email address or a MD5()'d hash of an email address, for example: [email protected] // Email address c1ec093716eb76ae6d92e8fdbd020c82 // MD5'd hash of the above email

It's quite simple, hey?

Basic Usage

It is just as simple to use, include the library in your PHP script and to display a Gravatar all you need to do is echo Gravatar::get_image('[email protected]');

But what if you want more control over what happens?

Advanced Usage

Well, we will give it to you if you require it! We allow you to edit a bunch of things ranging from a default image the the css class! You can edit:

  • default - The default images that Gravatar allows you to use (404, mm, identicon, monsterid, wavatar, retro) or, just link your own one up!
  • size - The size of the gravatar
  • rating - The rating of the image (G, PG, R, X)
  • force_default - Whether to or not display the default by force

For those above, you can also check the Gravatar docs at: http://en.gravatar.com/site/implement/images/

We also give you another two extra options, just to increase the ease of using this class:

  • generate_image - To generate HTML markup for the image
  • css_id - Add a custom class name to the image if generate_image is TRUE

Right, how can we use these options? Simple, we just write out an array and then add a second parameter to the method call. For example: $img_config = array( 'default' => 'mm', 'size' => 200, 'rating' => 'G', 'force_default' => FALSE, 'generate_image' => TRUE, 'css_id' => 'test' );

echo Gravatar::get_image('[email protected]', $img_config);

However, just remember you can include just the one configuration option, or all of them.. You choose, not us!

gravatar-php-class's People

Stargazers

Kaine Innes avatar

Watchers

Kaine Innes avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.