如何在php中修改SimpleImage.php中的

how modifications in php making SimpleImage

本文关键字:php SimpleImage 中的 修改      更新时间:2023-09-26

修改使得SimpleImage我想对代码做一些调整工作代码是在单个图像中编译带有文本的图像

		// making SimpleImage instances of selected friends including main image
		$img = new abeautifulsite'SimpleImage('main.jpg');
		$img1 = new abeautifulsite'SimpleImage('main2.jpg');
		$img2 = new abeautifulsite'SimpleImage('main3.jpg');
		$img3 = new abeautifulsite'SimpleImage('main4.jpg');
		$img4 = new abeautifulsite'SimpleImage('https://graph.facebook.com/1020534352325130/picture');
		$img1->resize(150, 150);
		$img2->resize(150, 150);
		$img3->resize(150, 150);
		$img4->resize(50, 50);
		$img->overlay($img1, 'bottom left', 1, 30, -25);
		$img->overlay($img2, 'bottom', 1, 0, -25);
		$img->overlay($img3, 'bottom right', 1, -30, -25);
		$img->overlay($img4, 'top', 1, 0, 25);
		$img->text('message', 'fb.OTF', 18, '#FFFFFF', 'top', 0, 20);
		$img->save('./dir/' . $_SESSION['gameid2'] . '.jpg');

php制作SimpleImage中的修改我想更改消息的行,但添加了服务器错误500

$img->text('<?php echo $user['name']; ?>', 'fb.OTF', 18, '#FFFFFF', 'top', 0, 20);

我还记得使用变量的图像,但发生了错误

$img4 = new abeautifulsite'SimpleImage('https://graph.facebook.com/<?php echo $user['id']; ?>/picture');

此代码在使用时效果良好,因此

<img src="https://graph.facebook.com/<?php echo $user['id']; ?>/picture" />
<?php echo $user['name']; ?>

请帮忙再见

问题出在<?php标记的位置上。取而代之的是:

$img->text('<?php echo $user['name']; ?>', 'fb.OTF', 18, '#FFFFFF', 'top', 0, 20);

试试这个:

<?php
$img->text($user['name'], 'fb.OTF', 18, '#FFFFFF', 'top', 0, 20);
?>

取而代之的是:

$img4 = new abeautifulsite'SimpleImage('https://graph.facebook.com/<?php echo $user['id']; ?>/picture');

试试这个:

<?php
$img4 = new abeautifulsite'SimpleImage('https://graph.facebook.com/' . $user['id'] . '/picture');
?>

当然,如果您的代码已经在PHP块中,则可以省略上面示例中的<?php ?>标记。