最終更新:2025-01-19 (日) 02:57:06 (21d)  

Gravatar
Top / Gravatar

http://ja.gravatar.com/

URL

  • const sha256 = require( 'js-sha256' );
    
    function getGravatarURL( email ) {
      // Trim leading and trailing whitespace from
      // an email address and force all characters
      // to lower case
      const address = String( email ).trim().toLowerCase();
    
      // Create a SHA256 hash of the final string
      const hash = sha256( address );
    
      // Grab the actual image URL
      return `https://www.gravatar.com/avatar/${ hash }`;
    }

関連