Talking about Facebook and Php.
Horror Profile is a Facebook application I developed a month ago.
Now it’s time to release the source code. You will find some useful tips about dynamic image creation with php.
If you are absolutely new to Facebook applications, I suggest you to read “Developing a Facebook Application for absolute beginners” posts 1, 2, 3, 4 and 5.
The idea is simple: placing the profile picture in a mirror (that is a transparent PNG image) and writing the user first name as big as I can.
500){
$it_fits=false;
}
} while($it_fits);
// adding the text
$center = floor((500-$last_dim[4]+$last_dim[6])/2);
imagettftext($im, $size-1, 0, $center, $last_dim[7]*-1+10, $shadow, $font, $text);
imagettftext($im, $size-1, 0, $center-1, $last_dim[7]*-1+9, $color, $font, $text);
// saving the image
imagejpeg($im,"temp/".$id.".jpg",80);
// freeing memory
imagedestroy($im);
imagedestroy($profile);
imagedestroy($mirror);
}
?>
require_login();
$my_array = $facebook->api_client->users_getInfo($user_id,"first_name,pic_big");
// getting user name and profile picture
$text = $my_array[0][first_name];
$pic = $my_array[0][pic_big];
// core function: creation of the horror picture
create_pic($user_id,$text,$pic);
$has_permission = $facebook->api_client->users_hasAppPermission("photo_upload");
if($has_permission and $_GET[pub]){
$response_array = $facebook->api_client->photos_upload("temp/".$user_id.".jpg", "", "Created with http://apps.facebook.com/horror_name/", $user_id);
}
?>
Hello , let's see how horrific is your profile:
Scare your friends!! Publish this horrific photo on your profile!!
PHOTO PUBLISHED
- Concept and coding by Emanuele Feronato
- Picture by AliceinDeadLand
Hope you will make something decent out of it…
Never miss an update! Subscribe, and I will bother you by email only when a new game or full source code comes out.