I'm trying to create simple facebook game. There is really required to do as much as possible on client-side. I generate dynamic .jpg to share game results on facebook wall using Feed method of FB.ui api. I've tried to use this code as image generator:
<?php
header ("Content-type: image/jpeg");
$pictureUrl = $_REQUEST['pic'];
$firstPlayerResult = $_REQUEST['fpr'];
$firstPlayerName = $_REQUEST['fpn'];
$secondPlayerResult = $_REQUEST['spr'];
$secondPlayerName = $_REQUEST['spn'];
$im = imagecreatefromjpeg($pictureUrl);
$white = imagecolorallocate($im, 0xFF, 0xFF, 0xFF);
$verdanaBold = './verdanab.ttf';
$verdana = './verdana.ttf';
imagefttext($im, 16, 0, 12, 33, $white, $verdanaBold, $firstPlayerResult);
imagefttext($im, 12, 0, 12, 50, $white, $verdana, $firstPlayerName);
$dimensions = imagettfbbox(12, 0, $verdana, $secondPlayerName);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x = 693 - $textWidth;
imagefttext($im, 16, 0, 603, 33, $white, $verdanaBold, $secondPlayerResult);
imagefttext($im, 12, 0, $x, 50, $white, $verdana, $secondPlayerName);
imagejpeg($im);
?>
But there is a problem. Script works fine when is opening in a browser - its display correct .jpg screen, but when I'm trying to past the URL link (with GET request) to js script into 'picture' field of Feed method from FB.ui, its return internal error (500). Similiar behaviour appears when I'm trying directly past link on my facebook wall (facebook don't parse image and displays only URL). How can I fix it and display correctly image as facebook feed?