Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/230.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在fb用户墙上生成随机图片和文本?_Php_Facebook - Fatal编程技术网

Php 如何在fb用户墙上生成随机图片和文本?

Php 如何在fb用户墙上生成随机图片和文本?,php,facebook,Php,Facebook,我在facebook上有一个用php编写的小脚本,当像fb粉丝页面这样的用户在他的墙上生成图片和文本时。。。这是脚本的一部分--> `函数行($filename){ $lines=文件($filename); 返回$lines[数组_rand($lines)]; } $reason=RandomLine(“reason.txt”) 现在我很感兴趣,是否可以生成随机的图片和文本?目前,我只能使用一个图像作为背景,通过文本 抱歉英语不好,我希望你能理解我需要什么…偶尔使用1.jpg以外的语言?你可

我在facebook上有一个用php编写的小脚本,当像fb粉丝页面这样的用户在他的墙上生成图片和文本时。。。这是脚本的一部分--> `函数行($filename){ $lines=文件($filename); 返回$lines[数组_rand($lines)]; } $reason=RandomLine(“reason.txt”)

现在我很感兴趣,是否可以生成随机的图片和文本?目前,我只能使用一个图像作为背景,通过文本


抱歉英语不好,我希望你能理解我需要什么…

偶尔使用1.jpg以外的语言?你可以使用任何你想要的源图像…嗯,马克,我可以用另一张图片来改变这张图片。。。但我想包括一些照片,将随机选择并在用户墙上生成。。我希望如此,你能理解我
$canvas = imagecreatefromjpeg ("1.jpg");                                 // background image file**
$black = imagecolorallocate( $canvas, 0, 0, 0 );                         // The second colour - to be used for the text
$font = "TAHOMABD.TTF";                                                         // Path to the font you are going to use
$fontsize = 16;                                                             // font size

$birthday = "".$user_profile['birthday']."";
$death = "".date('d/m/Y', strtotime( '+'.rand(0, 20000).' days'))."";

imagettftext( $canvas, 24, 0, 100, 70, $black, $font, $name );                // name
//imagettftext( $canvas, 10, -1, 122, 202, $black, $font, $death );              // death
//imagettftext( $canvas, 20, -1, 110, 170, $black, $font, $birthday );        // birthday
imagettftext( $canvas, 16, 0, 20, 235, $black, $font, $reason );         // reason


imagejpeg( $canvas, "img/".$fbid.".jpg", 50 );

$facebook->setFileUploadSupport(true);`