0

Currently I'm writing some text to an image with imagefttext in PHP.

Sometimes I have a text with an emoji in it and I'm just removing it, because I can't draw it in a nice way.

Now I want replace the emoji from the text with the actual image of the emoji, so the text looks on the image like it should look "normal" on a smartphone.

But now I'm despairing on how can I replace an emoji image with the correct emoji in the text.

Mr.Tr33
  • 838
  • 2
  • 18
  • 42
  • Duplicate of: https://stackoverflow.com/questions/32391005/php-function-imagettftext-to-write-text-with-smileys and https://stackoverflow.com/questions/23707654/php-imagettftext-and-specific-emoji – ad_on_is Jun 27 '17 at 20:17
  • well ... no it's not the same thing, I want to replace the text emoji with an image emoji but I don't know how to calculate the correct position – Mr.Tr33 Jun 27 '17 at 20:20
  • Sorry, my bad! I've an answer for you, that might help ;-) – ad_on_is Jun 27 '17 at 20:54

1 Answers1

0

You may want to split your text, create separate images for the text-parts, load your emoji-png at the end of each text-part and combine all these into one image.

Example: Hello world! :-) Foo bar :-P

So you create a imagefttext for Hello World! and use it's right x/y coordinates for the :-)PNG. Do the same for Foo bar and :-P

Here's an example how to merge that into one image: How to merge multiple images and text into single image?

ad_on_is
  • 1,500
  • 15
  • 27