1

modifications in php making SimpleImage I want to make some adjustments on a code Work code is a compilation of images with text in a single image

  // 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');

modifications in php making SimpleImage I want to make line changes the message but added this happened Server Error 500

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

I also recall the image using a variable as but an error occurred

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

This code works well when it is used so

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

Please help Good-bye

1 Answers1

1

The problem is with the placement of your <?php tags. Instead of this:

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

Try this:

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

And instead of this:

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

Try this:

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

Of course, if you're code is already inside a PHP block, you can omit the <?php ?> tags from the example above.

claviska
  • 12,410
  • 2
  • 27
  • 50
  • thax bru I have another question How do I make writing coded in this line utf_8 – Mouhssin duoi Jan 10 '16 at 19:11
  • When you call the Arabic name is not being displayed thank you very much – Mouhssin duoi Jan 10 '16 at 19:11
  • Make sure the font you're using supports Arabic characters and it should work fine. – claviska Jan 10 '16 at 22:41
  • Thank you so much I have used the Arabic line but is displayed from left to right As we know that the Arabic language is working from right to left – Mouhssin duoi Jan 15 '16 at 12:06
  • Seems like a GD issue. Related: http://stackoverflow.com/questions/21107740/displaying-right-to-left-connected-languages-like-persian-and-arabic-in-gd-p – claviska Jan 15 '16 at 17:08
  • Hello my friend As we know that the `main. jpg` is the background You could add other backgrounds and each time you download is the background of random selection Thank you – Mouhssin duoi Jan 20 '16 at 13:14