npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

adonis-gravatar

v0.0.1

Published

Integration gravatar into adonis

Downloads

8

Readme

Adonis Gravatar

Integration gravatar into adonis.

Getting Started

Install the package using the adonis CLI.

> adonis install adonis-gravatar

Instruction: (Click Here).

Instructions

Config

The config file is saved as config/gravatar.js.

module.exports = {
    size : Env.get('GRAVATAR_SIZE', 100),
    rating: Env.get('GRAVATAR_RATING', 'r'),
    default: Env.get('GRAVATAR_DEFAULT', 'mp')
}

or you can use environment variables that you can set on .env file.

GRAVATAR_SIZE=false
GRAVATAR_RATING=r
GRAVATAR_DEFAULT=mp

How To Use

on controller:

const Gravatar = use('Gravatar');

class AwesomeController {
  index ({ view }) {
    const gravatarUrl = Gravatar.generateSrc('[email protected]');
    // result: `https://www.gravatar.com/avatar/91f0a80a65760?s=100&r=r&d=retro`

    const gravatarHtmlImage = Gravatar.generateImage(
        '[email protected]', 'Current User'
    );
    const gravatarHtmlImageWithConfig = Gravatar.generateImage(
        '[email protected]', 'Current User', { size: 200, default: 'retro' }
    );
    // result: `<img src="https://www.gravatar.com/avatar/91f0a80a65760 alt="Current User" ... >`

    return gravatarUrl;
  }
}

on view:

<body>
  <h1>Hello World</h1>

  <div>
      <img 
        src="{{ gravatarUrl('[email protected]', { size: 100 })  }}" 
        alt="Current User">
  </div>

  <div>
    <!-- INFO: with {{{ ... }}} instead of {{ ... }} -->

    {{{ gravatarImage('[email protected]', 'Current User')  }}}

    <!-- with custom config -->
    {{{ gravatarImage('[email protected]', 'Current User', { width: 100, height: 100 })  }}}
    {{{ gravatarImage('[email protected]', 'Current User', { width: 100, height: 100, default: 'robohash' })  }}}
  </div>
</body>

Properties

| Argument | Description | Type | Default | | ------------- | ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | -------------------------------- | | size | Size of gravatar. | number | 100 | | rating | Rating of gravatar. | g, pg, r, x | r | | default | gravatar has a number of built in options which you can also use as defaults | 404, mp, identicon, monsterid, wavatar, retro, robohash, blank | mp |
| width | set attribute width for HTML image, used by gravatarImage function | string | same as size argument | | height | set attribute height for HTML image, used by gravatarImage function | string | same as size argument |

Authors