Recommend this page to a friend! |
Download .zip |
Info | View files (6) | Download .zip | Reputation | Support forum (1) | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2007-07-04 (9 years ago) | Not enough user ratings | Total: 502 | All time: 5,529 This week: 880 |
Version | License | PHP version | Categories | |||
magic_avatar 1.0 | GNU General Publi... | 4.3 | Graphics |
Description | Author | ||||||||||||||
This class can be used to generate avatar images for use with Yahoo messenger. |
|
Magic Yahoo! Messenger Avatar Generator Class General Information - Documentation File There is nothing hard to work with, to use the class do as the following: 1. Create a new class: [code] $avatar = new avatar(); [/code] 2. Add both big and small images: a. From file names: [code] $avatar->addSmallImageFromFile("/path/to/image.png"); //$avatar->addBigImageFromFile("/path/to/image.png"); [/code] b. From a GD Resource: [code] $avatar->addSmallImage($im); //$avatar->addBigImage($im); [/code] You may add one of the images by the A method and another one by the B method! It's obvious, ha? Note that the small image will be resized to 16x16 and the big image will be resized to 96x96 pixels. 3. {OPTIONAL STEP} Put a little text under the final avatar: [code] $avatar->addText(string $text [, integer $size [, array $coltext [, array $colrect]]]); [/code] Enter color arrays as the following: array(r, g, b) Default values are: $size: 2 $coltext: array(255, 255, 255) $colrect: array(0, 0, 0) ** ALWAYS use addText() before doing the next step ** 4. Mix 'em! (this is the abracadabra part :-D) [code] $avatar->mix(); [/code] mix() will return false if an error occured during the steps! 5. And the final job: a. Save avatar's file: [code] $avatar->saveAvatar("/path/to/the/avatar.png"); [/code] b. Show the avatar: [code] $avatar->showAvatar("avatar.png"); [/code] showAvatar() will return false if headers have been already sent. Not only $filename is used for when user wants to Right Click -> Save Image As..., but it also determines the image's type and the mime-type which should be passed to the user! If nothing entered as the value of $filename, class will generate a JPEG image. c. Let's see, you may have imageABC() function for example (assume ABC is an image format) and you want to show it to the user! There is no problem, you can call getAvatar() and have cache headers with sendCacheHeaders() and make your ABC image as the following: [code] $im = $avatar->getAvatar(); $avatar->sendCacheHeaders(); header("Content-type: Image/ABC"); imageABC($im); $avatar->destroy(); imagedestroy($im); [/code] ********** Remember not to change $im anymore! this would probably make avatar not to show properly! ********** 6. Free the allocated memory! [code] $avatar->destroy(); [/code] And we're done! |
Files |
File | Role | Description |
---|---|---|
avatar.class.php | Class | Main Class |
COPYING | Lic. | GNU GPL |
example.php | Example | Example |
README | Doc. | General Information - Documentation File |
small.png | Data | 16x16 Image |
big.png | Data | 96x96 Image |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
0% |
|
|
User Comments (1) | |||||
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.