0
我试图biuld Facebook的应用程序,我将用户配置文件图像与背景图像和用户的名称合并。这张图片是对成功回答测验的人的回报。合并facebook文件和图像的配置文件
这是从用户正在提交有答案后direceted页的初步认识代码:
if ($totalCorrect == 10) {
echo "Congrats!";
echo "<div id='results'>$totalCorrect/10 correct</div>";
echo '<img src="image.php">';
?>
这是image.php代码
<?php
// Create image instances
$im = imagecreatefromjpeg('xxx.jpg');
$black = ImageColorAllocate($im, 0, 0, 0);
//The canvas's (0,0) position is the upper left corner
//So this is how far down and to the right the text should start
$start_x = 200;
$start_y = 20;
$font = 'arial.ttf';
Imagettftext($im, 12, 0, $start_x, $start_y, $black, $font, 'text to write');
$url = "http://graph.facebook.com/".$user_profile. "/picture";
$dest = imagecreatefromjpeg($url);
// Copy and merge
imagecopymerge($im, $dest, 10, 10, 0, 0, 180, 180, 100);
//Creates the jpeg image and sends it to the browser
//100 is the jpeg quality percentage
// Output and free from memory
header('Content-Type: image/jpg');
imagejpeg($im);
imagedestroy($dest);
imagedestroy($src);
?>
如果我交换$ url到代码工作的静态图像,但不是当我尝试获取用户的配置文件时。有什么建议么?感谢您的支持!