我想做的是:
- 获取人物头像;
- 获取使用 de 开关设置的随机图片
- 并将随机图片与个人资料图片混合
- 并把它展示给那个家伙!
可以这样做吗?
require_once("src/facebook.php");
$configurar = array();
$configurar['appId'] = '2033xxxxx389';
$configurar['secret'] = 'cc3xxxx9b1';
$configurar['fileUpload'] = true;
$facebook = new Facebook($configurar);
$signed_request = $facebook->getSignedRequest();
$__idPagina = $signed_request["page"]["id"];
$__adminPagina = $signed_request["page"]["admin"];
$__statusLike = $signed_request["page"]["liked"];
$__pais = $signed_request["user"]["country"];
$__locale = $signed_request["user"]["locale"];
$_idUsuario = $facebook->getUser();
?>
<html>
<head></head>
<body>
<?
if($_idUsuario)
{
try
{
if($__statusLike)
{
//AQUI VAI A PARTE QUE FUNCIONA A MÁGICA DA FOTO! POORRA
// DEFINIR VARIAVEIS
$foto_x = $_idUsuario."_x.jpg";
$foto_y = $_idUsuario."_y.jpg";
$img = $_idUsuario.".jpg";
copy('http://graph.facebook.com/'.$_idUsuario.'/picture?width=150&height=150', 'lixeira/'.$foto_x);
//ARMA ALEATÓRIA NA BAGAÇA
$armaRandomica = rand(1,10);
//DEFINE O MOLDE DE ACORDO COMO O NUMERO QUE PEGOU AI /\
switch ($armaRandomica) {
case 1:
$moldeArma = "molde/_bazuka.jpg";
break;
case 2:
$moldeArma = "molde/_espada.jpg";
break;
case 3:
$moldeArma = "molde/_espingarda.jpg";
break;
case 4:
$moldeArma = "molde/_faca.jpg";
break;
case 5:
$moldeArma = "molde/_granada.jpg";
break;
case 6:
$moldeArma = "molde/_metralhadora.jpg";
break;
case 7:
$moldeArma = "molde/_nokia.jpg";
break;
case 8:
$moldeArma = "molde/_pistola.jpg";
break;
case 9:
$moldeArma = "molde/_shotgun.jpg";
break;
case 10:
$moldeArma = "molde/_sniper.jpg";
break;
}
echo '<img src="'.$moldeArma.'" />';
//JUNTAR A FOTO DO PERFIL COM O MOLDE!
header("Content-type:image/jpeg");
$stamp = imagecreatefromjpeg($foto_x);
$im = imagecreatefromjpeg($moldeArma);
$marge_right = 20;
$marge_bottom = 330;
$sx = imagesx($stamp);
$sy = imagesy($stamp);
imagecopy($im, $stamp, imagesx($im) - $sx - $marge_right, imagesy($im) - $sy - $marge_bottom, 0, 0, imagesx($stamp), imagesy($stamp));
imagejpeg($im, $foto_y,100);
imagedestroy($im);
exit;
//USA ISSO COMO $perfilUsuario['name'] e talz!
$perfilUsuario = $facebook->api('/me','GET');
//MOSTRA A FOTO PRO NEGRO!
echo '<img src="lixeira/'.$foto_x.'" />';
}
else
{
echo '<center><img src="imagens/curta.png"/></center>';
}
}
catch(FacebookApiException $e)
{
$urlLogin = $facebook->getLoginUrl();
echo 'Porfavor <a href="'.$urlLogin.'">LOGUE!</a>';
error_log($e->getType());
error_log($e->getMessage());
}
}
else
{
$urlLogin = $facebook->getLoginUrl();
echo 'Porfavor <a href="'.$urlLogin.'">LOGUE!</a>';
}
?>
</body>
</html>
这就是我从该代码中得到的,我应该怎么做才能修复这个错误?
http://i.stack.imgur.com/lrFKd.png
帮助我的人=D