Avatar saver

Results 1 to 17 of 17
  1. #1
    Apprentice Predator359 is offline
    MemberRank
    Feb 2012 Join Date
    24Posts

    Avatar saver

    hello,
    This morning, I coded a little simple but useful (for me) so I could share if it be useful for some:
    The purpose of this file is replaced by the avatar-imaging of habbo.com and so if one day habbo.com is down for maintenance and well when it displays the same look. It records every look of users and displays.
    Used to simply create a folder avatar is the root of your site, place the file in the root avatar.php. We must also modify the file avatar.php with your domain name
    Code:
    <?php
    	#Coded by Predator3598
    	#For Ragezone
    function creerFichier($fichierChemin, $fichierNom, $fichierExtension, $fichierContenu, $droit=""){
    $fichierCheminComplet = $_SERVER["DOCUMENT_ROOT"].$fichierChemin."/".$fichierNom;
    if($fichierExtension!=""){
    $fichierCheminComplet = $fichierCheminComplet.".".$fichierExtension;
    }
     
    // create file on server
    $leFichier = fopen($fichierCheminComplet, "wb");
    fwrite($leFichier,$fichierContenu);
    fclose($leFichier);
     
    // permission
    if($droit==""){
    $droit="0777";
    }
     
    // Checking if the file was created well
    $t_infoCreation['fichierCreer'] = false;
    if(file_exists($fichierCheminComplet)==true){
    $t_infoCreation['fichierCreer'] = true;
    }
     
    // we apply the permission to the file created
    $retour = chmod($fichierCheminComplet,intval($droit,8));
    $t_infoCreation['permissionAppliquer'] = $retour;
     
    return $t_infoCreation;
    }
    	if(isset($_GET['look']))
    		{
    			$look = $_GET['look'];
    			if(file_exists($_SERVER["DOCUMENT_ROOT"]."/avatar/".$look.".gif"))
    				{
    					$imagesrv = "http://yourdomain.com/avatar/".$look.".gif";
    					$img = file_get_contents($imagesrv);
    					header("Content-type: image/png");
    					echo($img);
    				}
    			else
    				{
    					$image = "http://www.habbo.com/habbo-imaging/avatarimage?figure=".$look."&size=b&direction=3&head_direction=3&gesture=sml";
    					$dataimg = file_get_contents($image);
    					creerFichier("/avatar", $look, "gif", $dataimg, "0777");
    					$imagesrv = "http://www.yourdomain.com/avatar/".$look.".gif";
    					$img = file_get_contents($imagesrv);
    					header("Content-type: image/png");
    					echo($img);
    				}
    		}
    	else
    		{
    			echo("Error: The variables are not filled! ( ?look= )");
    		}
    ?>
    Research in your page http://www.habbo.com/habbo-imaging/avatarimage?... and replace it by http://yourdomain.com/avatar.php?look=<?php codeforlook ?>
    Predator3598
    Last edited by Predator359; 01-03-12 at 02:32 PM.


  2. #2

    Re: Avatar saver

    Thanks, exactly what I'm in search of!

    English comments please?

  3. #3
    Apprentice Predator359 is offline
    MemberRank
    Feb 2012 Join Date
    24Posts

    Re: Avatar saver

    Oh sorry ==> Edited

  4. #4
    Apprentice TheArt is offline
    MemberRank
    Mar 2012 Join Date
    NetherlandsLocation
    12Posts

    Re: Avatar saver

    Just use Habbo.nl and that issue is solved? Habbo.com goes to maintenance often although Habbo.nl is on maintenance maybe twice a month. Plus if you are ripping avatar images on every time someone loads the logged in page (me) then it will really slow down your site as there are billions of combinations of looks someone can have. Plus if you are changing the angle of the avatar head, body, etc. Not a good idea, nice release but in practice it is probably not worth it.

  5. #5
    Apprentice Predator359 is offline
    MemberRank
    Feb 2012 Join Date
    24Posts

    Re: Avatar saver

    Yes, I used habbo.nl but hey I do this page as it suits me and I release thinking it might help some people who seek the same thing. and I tested suchargé by causing a little over 100 <img with the page loads quickly and even instantly like putting habbo.com

  6. #6
    Apprentice TheArt is offline
    MemberRank
    Mar 2012 Join Date
    NetherlandsLocation
    12Posts

    Re: Avatar saver

    Quote Originally Posted by Predator359 View Post
    Yes, I used habbo.nl but hey I do this page as it suits me and I release thinking it might help some people who seek the same thing. and I tested suchargé by causing a little over 100 <img with the page loads quickly and even instantly like putting habbo.com
    Yea I am not saying your release is dumb. I am saying that with the number of permutations for the Habbo looks would be quite a bit (many billions). You would have to utilize gigabytes of space to store all the images. I will show you.

    Possibilities

    Gender: 2
    Skin Color: 30
    Hair: 38
    Hair Color: 47

    With just calculating those 4 traits alone there are 2 * 30 * 38 * 47 (107,160) unique possibilities. It would be unreasonable to use this script, in practice.

  7. #7
    Apprentice Predator359 is offline
    MemberRank
    Feb 2012 Join Date
    24Posts

    Re: Avatar saver

    It is true ... I'll try to work on a habbo-imaging as Sulake

  8. #8

    Re: Avatar saver

    Uhuh, this is what I've:
    Code:
    <?php
    	#Coded by Predator3598
    	#For Ragezone
    function creerFichier($fichierChemin, $fichierNom, $fichierExtension, $fichierContenu, $droit=""){
    $fichierCheminComplet = $_SERVER["DOCUMENT_ROOT"].$fichierChemin."/".$fichierNom;
    if($fichierExtension!=""){
    $fichierCheminComplet = $fichierCheminComplet.".".$fichierExtension;
    }
     
    // create file on server
    $leFichier = fopen($fichierCheminComplet, "wb");
    fwrite($leFichier,$fichierContenu);
    fclose($leFichier);
     
    // permission
    if($droit==""){
    $droit="0777";
    }
     
    // Checking if the file was created well
    $t_infoCreation['fichierCreer'] = false;
    if(file_exists($fichierCheminComplet)==true){
    $t_infoCreation['fichierCreer'] = true;
    }
     
    // we apply the permission to the file created
    $retour = chmod($fichierCheminComplet,intval($droit,8));
    $t_infoCreation['permissionAppliquer'] = $retour;
     
    return $t_infoCreation;
    }
    	if(isset($_GET['look']))
    		{
    			$look = $_GET['look'];
    			if(file_exists($_SERVER["DOCUMENT_ROOT"]."/avatar/".$look.".gif"))
    				{
    					$imagesrv = "http://localhost/avatar/".$look.".gif";
    					$img = file_get_contents($imagesrv);
    					header("Content-type: image/png");
    					echo($img);
    				}
    			else
    				{
    					$image = "http://www.habbo.com/habbo-imaging/avatarimage?figure=".$look."&size=b&direction=3&head_direction=3&gesture=sml";
    					$dataimg = file_get_contents($image);
    					creerFichier("/avatar", $look, "gif", $dataimg, "0777");
    					$imagesrv = "http://localhost/avatar/".$look.".gif";
    					$img = file_get_contents($imagesrv);
    					header("Content-type: image/png");
    					echo($img);
    				}
    		}
    	else
    		{
    			echo("Error: The variables are not filled! ( ?look= )");
    		}
    ?>
    And in my index, I edited it so as it looks like this (doesn't work)
    Code:
    <img src="http://localhost/avatar.php?look={figure}&action=wav&direction=2&head_direction=3&gesture=srp&size=l" id="user"/>
    which originally worked with
    Code:
    <img src="http://http://www.habbo.com/habbo-imaging/avatarimage??figure={figure}&action=wav&direction=2&head_direction=3&gesture=srp&size=l" id="user"/>
    so {figure} tag must be valid, the error therefore lies somewhere else. I'm new to PHP, but it makes more sense to me that the error is within the script. Help, anyone? Thanks in advance.

  9. #9
    Apprentice Predator359 is offline
    MemberRank
    Feb 2012 Join Date
    24Posts

    Re: Avatar saver

    delete &action=wav&direction=2&head_direction=3&gesture=srp&size=l on your index after {figure}
    and in your avatar.php &size=b&direction=3&head_direction=3&gesture=sml
    replace by &action=wav&direction=2&head_direction=3&gesture=srp&size=l
    for change the direction etc

  10. #10
    Member At0m is offline
    MemberRank
    Feb 2011 Join Date
    88Posts

    Re: Avatar saver

    Nice Release, liked received.
    Maybe i´m gonna use this in RetroCMS, with your credits, of course.

  11. #11
    Apprentice Predator359 is offline
    MemberRank
    Feb 2012 Join Date
    24Posts

    Re: Avatar saver

    Oh Thank's it's a honnor !

  12. #12
    Proficient Member Squard is offline
    MemberRank
    Dec 2011 Join Date
    155Posts

    Re: Avatar saver

    Nice, when habbo is in maintenance you got the most avatars :)

  13. #13

    Re: Avatar saver

    The script doesn't grab any avatar from Habbo, or is it a permission problem? I'm on IIS, and I tried your previous reply which obviously didn't work.

    My avatar.php:
    Code:
    <?php
    	#Coded by Predator3598
    	#For Ragezone
    function creerFichier($fichierChemin, $fichierNom, $fichierExtension, $fichierContenu, $droit=""){
    $fichierCheminComplet = $_SERVER["DOCUMENT_ROOT"].$fichierChemin."/".$fichierNom;
    if($fichierExtension!=""){
    $fichierCheminComplet = $fichierCheminComplet.".".$fichierExtension;
    }
     
    // create file on server
    $leFichier = fopen($fichierCheminComplet, "wb");
    fwrite($leFichier,$fichierContenu);
    fclose($leFichier);
     
    // permission
    if($droit==""){
    $droit="0777";
    }
     
    // Checking if the file was created well
    $t_infoCreation['fichierCreer'] = false;
    if(file_exists($fichierCheminComplet)==true){
    $t_infoCreation['fichierCreer'] = true;
    }
     
    // we apply the permission to the file created
    $retour = chmod($fichierCheminComplet,intval($droit,8));
    $t_infoCreation['permissionAppliquer'] = $retour;
     
    return $t_infoCreation;
    }
    	if(isset($_GET['look']))
    		{
    			$look = $_GET['look'];
    			if(file_exists($_SERVER["DOCUMENT_ROOT"]."/avatar/".$look.".gif"))
    				{
    					$imagesrv = "http://localhost/avatar/".$look.".gif";
    					$img = file_get_contents($imagesrv);
    					header("Content-type: image/png");
    					echo($img);
    				}
    			else
    				{
    					$image = "http://www.habbo.com/habbo-imaging/avatarimage?figure=".$look."&action=wav&direction=2&head_direction=3&gesture=srp&size=l";
    					$dataimg = file_get_contents($image);
    					creerFichier("/avatar", $look, "gif", $dataimg, "0777");
    					$imagesrv = "http://localhost/avatar/".$look.".gif";
    					$img = file_get_contents($imagesrv);
    					header("Content-type: image/png");
    					echo($img);
    				}
    		}
    	else
    		{
    			echo("Error: The variables are not filled! ( ?look= )");
    		}
    ?>
    and my tag:
    Code:
    <img src="avatar.php?look={figure}" id="user"/>
    Not looking like any problem lies here? Thanks in advance.

  14. #14
    Apprentice Predator359 is offline
    MemberRank
    Feb 2012 Join Date
    24Posts

    Re: Avatar saver

    With XAMPP and my webhosting your script work fine.
    Do you have create "avatar" folder ?

  15. #15
    I don't even know azaidi is offline
    MemberRank
    Apr 2010 Join Date
    the NetherlandsLocation
    2,065Posts

    Re: Avatar saver

    Use an older version of PHP if you have an error with this ;D

  16. #16
    Account Upgraded | Title Enabled! BoomHotel is offline
    MemberRank
    Oct 2008 Join Date
    In a box.Location
    372Posts

    Re: Avatar saver

    Images don't load?

  17. #17
    Apprentice Predator359 is offline
    MemberRank
    Feb 2012 Join Date
    24Posts

    Re: Avatar saver

    What ?



Advertisement