Hi,
I'm trying to create a script that grabs a figure image from habbo-imaging, and crops it to a square containing the figure's head and shoulders.
That's what I've got so far, and all the script generates is a black square.PHP Code:<?php
header( "Content-type: image/png" );
$figure = "hr-828-45.lg-285-64.ch-215-110.hd-180-2.sh-290-62.he-1607-";
$original_image = imagecreatefrompng("http://www.habbo.com.tr/habbo-imaging/avatarimage?figure=".$figure."");
// create a blank image having the same width and height as the crop area
// this will be our cropped image
$cropped_image = imagecreatetruecolor(64, 64);
// copy the crop area from the source image to the blank image created above
imagecopy($cropped_image, $original_image, 0, 0, 64, 21, 64, 64);
imagepng($cropped_image);
// free resources
imagedestroy($cropped_image);
imagedestroy($original_image);
?>
Any ideas?


Reply With Quote

