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 8342615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:49:27+00:00 2026-06-09T05:49:27+00:00

I got good result in PHP/GD to write text to image template, text wraps

  • 0

I got good result in PHP/GD to write text to image template, text wraps fine but is not “smooth”, here is the code I am using:

<?php

header("Content-type: image/png");

$text = "go to school go to school go to school go to school go to school go to school go to school go to school go to school go to school go to school ";
$arrText=explode("\n",wordwrap($text,60,"\n"));

$im = imagecreatefrompng("template.png");
$y = 15; //vertical position of text
foreach($arrText as $arr)
{
    $white = imagecolorallocate($im,0,0,0); //sets text color
    imagestring($im,5,15,$y,trim($arr),$white); //create the text string for image,added     trim() to remove unwanted chars
    $y = $y+20;

}
imagepng($im);
imagedestroy($im);
?>
  • 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-06-09T05:49:29+00:00Added an answer on June 9, 2026 at 5:49 am

    Try turning on anti-aliasing:

    imageantialias($im, true);
    

    Does that make it look any better?

    Or else try imagettftext with a truetype font:

    imagettftext ( $im, 15, 0, 15, $y, $white, 'fontfile.ttf', trim($arr));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Since my AS3 and Php/Java knowledge is not good I got stuck on this
Hi guys i previously asked a question and got a good solution. here is
i'm not so good at jquery and i've got this issue: i'm using jquery
I got 12 .php files with this code: if($_GET['u']){ $srcp = imagecreatefrompng(http://www.minecraft.net/skin/.$_GET['u']..png); $destp =
I was given good direction to solve a problem today from here but I
Here's an image: The HTML is in a php which is as follows: print
Anyone got a good handle on a barcode scanning library that can be used
Anyone got some good references for targeting web content to the iPad web browser?
This is a CSS related question, I got one good answer from my previous
I got a question about good practice. I'm making a simple game and, I'm

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.