QR Codes are 2-dimensional barcodes that can encode various types of information, which can be read using a cell phone or other camera-based devices. Gravatar provides simple QR codes that contain a link to the main profile page for the requested profile.
Base Request – with an Email Address
Follow these steps to request a QR code for a profile associated with an email address:
1. Create a valid email hash: Use an MD5 hash of the email address associated with the Gravatar profile.
2. Build the URL: Construct the URL to request the profile page using the email hash:
https://gravatar.com/{hash}
3. Append .qr to the URL: Indicate that you want the results in QR Code format by appending .qr
to the URL:
https://gravatar.com/{hash}.qr
Example URL:
https://gravatar.com/27205e5c51cb03f862138b22bcb5dc20f94a342e744ff6df1b8dc8af3c865109.qr
When you request this URL in your browser, you will receive a QR Code image in PNG format that links directly to the profile page when scanned by a QR-compatible device.
Requesting a QR Code with a Username
Follow these steps to request a QR code for a profile associated with a username:
1. Know the username:
Obtain the username from the URL of their profile:
https://gravatar.com/username)
2. Append .qr to that URL:
Indicate that you want the results in QR Code format by appending .qr
to the URL:
https://https://gravatar.com/ronnie.qr
Parameters and Requests Options
You can customize the QR code output with the following parameters:
- size (or s): Specify the edge length of the QR code image in pixels. As QR codes are square, you only need to provide one value.
- type: Choose what to display in the center of the QR code:
- blank or default: No logo or avatar.
- user: User’s avatar.
- gravatar: Gravatar logo.
- version: Select the style of the QR code:
- blank or 1: Standard QR code.
- 3: Modern “small dots” QR code.
Example
Embedding a QR code in an img
tag:
<img src="https://gravatar.com/27205e5c51cb03f862138b22bcb5dc20f94a342e744ff6df1b8dc8af3c865109.qr?type=gravatar&version=3&s=350" />
This example generates a QR code with the Gravatar logo in the center, using the modern small dots style.
Tips
- Default Size: QR codes default to 80px by 80px if the size parameter is not supplied.
- Encoded Data: The QR code only encodes a link to the profile page.
- Compatibility: Modern mobile devices can read QR codes directly from the camera.
- Profile Data: Profile requests will only resolve for the hash of the primary address on an account. Users may have multiple addresses on a single account, so while a Gravatar image request may return a result, a profile request for the same hash may not.
By following these guidelines, you can effectively generate and customize QR codes for Gravatar profiles.