[PHP] AvatarImage from scratch

Page 1 of 5 12345 LastLast
Results 1 to 15 of 75
  1. #1
    Enthusiast Bas Milius is offline
    MemberRank
    Dec 2012 Join Date
    48Posts

    [PHP] AvatarImage from scratch

    Hi all,

    So, a while ago i started to develop Habbo's avatarimage.php..


    In the most retro-websites we use:
    http://www.habbo.nl/habbo-imaging/av...ure=sml&size=b


    What if Habbo is in maintenance or Habbo is offline.. And we don't cache it.. What do we do now?


    Well, i've a solution!
    A couple of days ago, i've started developing a Class called Avatar.
    This Class read's al the needed files, figuredata.xml, animation.xml and stuff and makes an full avatar out it.

    Code Snippet
    PHP Code:
    <?php
    function imagerecolor(&$image$red$green$blue)
    {
        
    $width imagesx($image);
        
    $height imagesy($image);
        
        for(
    $x 0$x $width$x++)
        {
            for(
    $y 0$y $height$y++)
            {
                
    $rgb imagecolorsforindex($imageimagecolorat($image$x$y));
                
    $r $rgb['red'];
                
    $g $rgb['green'];
                
    $b $rgb['blue'];
                
    $a $rgb['alpha'];
                
                
    $r = (($red 255) * $r);
                
    $g = (($green 255) * $g);
                
    $b = (($blue 255) * $b);
                
                
    imagesetpixel($image$x$yimagecolorallocatealpha($image$r$g$b$a));
            }
        }
    }
    ?>
    This snippet comes directly out of Pixel(Time)CMS.


    Samples



    Well, i haven't seen an retro yet with an own avatarimage.php script.. So i thought.. I'll make it!


    Bas


  2. #2
    Live Ocottish Sverlord Joopie is offline
    LegendRank
    Jun 2010 Join Date
    The NetherlandsLocation
    2,767Posts

    Re: [PHP] AvatarImage from scratch

    I hope you know that PHP uses -127 to 127 for colors and not 0 to 255. :)

    Also, how do you get the images?

  3. #3
    Enthusiast Bas Milius is offline
    MemberRank
    Dec 2012 Join Date
    48Posts

    Re: [PHP] AvatarImage from scratch

    Quote Originally Posted by joopie View Post
    I hope you know that PHP uses -127 to 127 for colors and not 0 to 255. :)

    Also, how do you get the images?
    PHP uses 0-255 for colors:
    PHP: imagecolorallocate - Manual

    I've decompille all the swf's that are needed :)

  4. #4
    Live Ocottish Sverlord Joopie is offline
    LegendRank
    Jun 2010 Join Date
    The NetherlandsLocation
    2,767Posts
    Quote Originally Posted by Bas Milius View Post
    PHP uses 0-255 for colors:PHP: imagecolorallocate - ManualI've decompille all the swf's that are needed :)
    Whoops, mistake. It was Alpha. Dammed :xAnd wow. That are lots of files :x. Ever thought that you need more then just some images and 2 xml files?

  5. #5
    Enthusiast Bas Milius is offline
    MemberRank
    Dec 2012 Join Date
    48Posts

    Re: [PHP] AvatarImage from scratch

    Quote Originally Posted by joopie View Post
    Whoops, mistake. It was Alpha. Dammed :xAnd wow. That are lots of files :x. Ever thought that you need more then just some images and 2 xml files?
    Well, i needed:
    - animation.xml (This class supports frames, go to Pixel: Het Team to see it in action)
    - draworder.xml (For the order of parts)
    - figuredata.xml (Main figure data)
    - partsets.xml (For some rotations, Habbo uses other part types)
    - All the images and the manifest files in the swf's

    I'm now trying to make hh_human_fx :)
    So hope that effects work too soon :D

  6. #6
    Proficient Member MrSolution is offline
    MemberRank
    May 2012 Join Date
    174Posts

    Re: [PHP] AvatarImage from scratch

    This looks interesting.

  7. #7
    [̲̅$̲̅(̲̅1̲̅)̲̅$ ̲̅] leenster is offline
    MemberRank
    May 2008 Join Date
    KanaadaLocation
    992Posts

    Re: [PHP] AvatarImage from scratch

    good luck with this

  8. #8

    Re: [PHP] AvatarImage from scratch

    Looks good.

    Good luck with this dev.

  9. #9
    Banned V for Vendetta is offline
    BannedRank
    Feb 2007 Join Date
    1,809Posts

    Re: [PHP] AvatarImage from scratch

    Looks very good like Notak said.

    Good luck on to further developing related to this ;-)

  10. #10
    <insert title here> Shorty is offline
    MemberRank
    Feb 2007 Join Date
    United KingdomLocation
    1,861Posts

    Re: [PHP] AvatarImage from scratch

    Seen these types of scripts for games like MapleStory, it's a pre cool idea. I always thought about doing it, but group badges was already painful enough and all that is; is a few images on top of each other.

    Good luck. :-)

  11. #11
    Enthusiast Bas Milius is offline
    MemberRank
    Dec 2012 Join Date
    48Posts

    Re: [PHP] AvatarImage from scratch

    Well, thanks for the good responses :-)

    I've also coded an feature to show only the head of an user..

    http://www.pixeltime.nl/imaging/avat...pe=head&nosave
    (dir can be 0-7)

  12. #12
    Proficient Member MrSolution is offline
    MemberRank
    May 2012 Join Date
    174Posts

    Re: [PHP] AvatarImage from scratch

    Quote Originally Posted by Bas Milius View Post
    Well, thanks for the good responses :-)

    I've also coded an feature to show only the head of an user..

    http://www.pixeltime.nl/imaging/avat...pe=head&nosave
    (dir can be 0-7)
    Epic dude!

  13. #13
    Enthusiast Bas Milius is offline
    MemberRank
    Dec 2012 Join Date
    48Posts

    Re: [PHP] AvatarImage from scratch

    Also check this out!
    Pixel: Maak vrienden, doe mee en val op!
    Avatars can actually walk :)

  14. #14
    [̲̅$̲̅(̲̅1̲̅)̲̅$ ̲̅] leenster is offline
    MemberRank
    May 2008 Join Date
    KanaadaLocation
    992Posts

    Re: [PHP] AvatarImage from scratch

    You are making huge progress. Keep it up.

  15. #15
    Enthusiast Bas Milius is offline
    MemberRank
    Dec 2012 Join Date
    48Posts

    Re: [PHP] AvatarImage from scratch

    Fixed bug: User has 2 hair colors but we only show one color.
    Now we show both :D


    EDIT: User can now smile, be sad, be angry, be suprised or sleep
    Last edited by Bas Milius; 03-01-13 at 02:07 AM.



Page 1 of 5 12345 LastLast

Advertisement