Download the PHP package phalcon/incubator-avatar without Composer
On this page you can find all versions of the php package phalcon/incubator-avatar. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package incubator-avatar
Phalcon\Incubator\Avatar
Usage examples of the adapters available here:
Gravatar
Gravatar's are universal avatars available to all web sites and services. Users must register their email addresses with Gravatar before their avatars will be usable in your project.
Getting Started
Setup through setters
Setup through config
Using
Configuration
Gravatar size
Gravatar allows avatar images ranging from 0px to 2048px in size. With using 0px size, images from Gravatar will be returned as 80x80px.
Example:
If an invalid size (less than 0, greater than 2048) or a non-integer value is specified,
this method will throw an exception of class \InvalidArgumentException
.
Default Image
Gravatar provides several pre-fabricated default images for use when the email address provided does not have a gravatar or when the gravatar specified exceeds your maximum allowed content rating. In addition, you can also set your own default image to be used by providing a valid URL to the image you wish to use.
There are a few conditions which must be met for default image URL:
- MUST be publicly available (e.g. cannot be on an intranet, on a local development machine, behind HTTP Auth or some other firewall etc). Default images are passed through a security scan to avoid malicious content
- MUST be accessible via HTTP or HTTPS on the standard ports, 80 and 443, respectively
- MUST have a recognizable image extension (jpg, jpeg, gif, png)
- MUST NOT include a query string (if it does, it will be ignored)
Possible values:
404
— do not load any image if none is associated with the email, instead return an HTTP 404 (File Not Found) responsemm
— (mystery-man) a simple, cartoon-style silhouetted outline of a person (does not vary by email)identicon
— a geometric pattern based on an emailmonsterid
— a generated 'monster' with different colors, faces, etcwavatar
— generated faces with differing features and backgroundsretro
— awesome generated, 8-bit arcade-style pixelated facesblank
— a transparent PNG image- boolean false — if using the default gravatar image
- Image URL
Example:
If an invalid default image is specified (both an invalid prefab default image and an invalid URL is provided),
this method will throw an exception of class \InvalidArgumentException
.
Using secure connection
Should we use the secure (HTTPS) URL base? If your site is served over HTTPS, you'll likely want to serve gravatars over HTTPS as well to avoid "mixed content warnings".
Example:
To check to see if you are using "secure images" mode, call the method Gravatar::isUseSecureURL()
,
which will return a boolean value regarding whether or not secure images mode is enabled.
Gravatar Rating
Gravatar provides four levels for rating avatars by, which are named similar to entertainment media ratings scales used in the United States.
Possible values:
Gravatar::RATING_G
— suitable for display on all websites with any audience typeGravatar::RATING_PG
— may contain rude gestures, provocatively dressed individuals, the lesser swear words, or mild violenceGravatar::RATING_R
— may contain such things as harsh profanity, intense violence, nudity, or hard drug useGravatar::RATING_X
— may contain hardcore sexual imagery or extremely disturbing violence
By default, the Gravatar rating is Gravatar::RATING_G
.
Example:
If an invalid maximum rating is specified, this method will throw an exception of class \InvalidArgumentException
.
Force Default
If for some reason you wanted to force the default image to always load, you can enable or disable it.
Example:
To check to see if you are using "Force Default" mode,
call the method Gravatar::isUseForceDefault()
, which will return a boolean value.
All versions of incubator-avatar with dependencies
ext-phalcon Version ^4.0
ext-json Version *