Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7414199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:03:55+00:00 2026-05-29T07:03:55+00:00

I googled this a lot and couldn’t find an answer, is there some kind

  • 0

I googled this a lot and couldn’t find an answer, is there some kind of limitation to imagettftext() in PHP GD Library? I called it three times on the same image but the third doesn’t seem to appear. How can I “draw” three imagettftext() on the same image?

Thanks in advance!

Here’s the code:
I use this function to generate a border:

function imagettfstroketext(&$image, $size, $angle, $x, $y, &$textcolor, &$strokecolor, $fontfile, $text, $px){
    for($c1 = ($x-abs($px)); $c1 <= ($x+abs($px)); $c1++){
        for($c2 = ($y-abs($px)); $c2 <= ($y+abs($px)); $c2++){
            $bg = imagettftext($image, $size, $angle, $c1, $c2, $strokecolor, $fontfile, $text);
        }
    }
    return imagettftext($image, $size, $angle, $x, $y, $textcolor, $fontfile, $text);
}

Then I set the variables from the HTML form:

$text = strip_tags(htmlspecialchars_decode(stripslashes($_GET['text'])));
$text = str_replace('&gt;', '>', $text);
$text = str_replace('&lt;', '<', $text);
$text = str_replace('&quot;', '"', $text);
$text = str_replace('and_sign', '&', $text);

$text2 = strip_tags(htmlspecialchars_decode(stripslashes($_GET['text2'])));
$text2 = str_replace('&gt;', '>', $text2);
$text2 = str_replace('&lt;', '<', $text2);
$text2 = str_replace('&quot;', '"', $text2);
$text2 = str_replace('and_sign', '&', $text2);

$text3 = strip_tags(htmlspecialchars_decode(stripslashes($_GET['text3'])));
$text3 = str_replace('&gt;', '>', $text3);
$text3 = str_replace('&lt;', '<', $text3);
$text3 = str_replace('&quot;', '"', $text3);
$text3 = str_replace('and_sign', '&', $text3);

More variables:

$image = imagecreatefrompng('images/'.$base.'.png');
$size = '12';
$angle = '0';
$font = 'font/' . strip_tags($_GET['font']) . '.ttf';
if (!$_GET['font']) $font = 'font/visitor2.ttf';

And then I use the function to draw the text:

imagettfstroketext($image, $size, $angle, 4, 12, $text_colour, $text_outline, $font, $text, 1);
imagettfstroketext($image, $size, $angle, 10, 20, $text_colour, $text_outline, $font, $text2, 1);
imagettfstroketext($image, $size, $angle, 4, 30, $text_colour, $text_outline, $font, $text3, 1);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T07:03:56+00:00Added an answer on May 29, 2026 at 7:03 am

    There is no limitation on the function, you can use it as much as you want on any image. Maybe you are just trying to write outside of the image with bad coordinates or the color of the text is the same as the background so you can’t see it.

    Anyway, I advise you to print to a file the variables used by the function when it doesn’t work to see if all is right.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I googled this a little but couldn't find a good result. Right now I'm
I have googled this a little and didn't really find the answer I needed.
I am new to Emacs. I have googled this but no good answer there.
I am going crazy now. Googled this, thought some kind of IDE bug. Maybe
I googled a lot to find various hints what could cause this problem. Many
I've been thinking of this question very long, but really couldn't find the answer
I have been looking around for an answer to this, but couldn't really find
This is another design pattern in some legacy code that I couldn't find much
I have googled a lot on this and i have found integrations of Linkedin
I know there's a lot of resource for this via google, but I just

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.