File: simple_example.html

Recommend this page to a friend!
  Classes of Arturs Sosins   JavaScript Initial Avatar Creator   simple_example.html   Download  
File: simple_example.html
Role: Example script
Content type: text/plain
Description: Simple example
Class: JavaScript Initial Avatar Creator
Render an avatar image with the user initials
Author: By
Last change:
Date: 9 years ago
Size: 1,175 bytes


Class file image Download
<!DOCTYPE html> <!-- /************************************************************* * This script is developed by Arturs Sosins aka ar2rsawseen, * Feel free to distribute and modify code, but keep reference to its creator * * Initial Avatar class creates avatars for users from user initials. * It creates a hash from the user's name and generates a background color based on it. * Then it gets a complimentary color for the text, and calculates text size and position * based on the font and length of initials. * This package can output binary image data, or apply image to existing img element * or create new img element * * For more information, examples and online documentation visit: * **************************************************************/ --> <html> <head> </head> <body> <p><img id='test' src=''/></p> <script type='text/javascript' src='initialAvatar.js'></script> <script type='text/javascript'> var av = new initialAvatar("Arturs Sosins"); document.getElementById("test").src = av.getData(); </script> </body> </html>