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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:14:31+00:00 2026-05-26T09:14:31+00:00

I am using PHP to generate images containing only text. Using a variety of

  • 0

I am using PHP to generate images containing only text. Using a variety of different fonts, i.e. Adler, Arial, Vladimir etc.

However I want to be able to specify the height of the image before hand, i.e. 100 pixels and then have the text set to that height and continue as wide as need be.

But I am having issues with using the font size parameter, i.e. font size 100 isn’t the same across all my font files and I am not sure how to set the size to get the desired result in pixels.

Is there a way around this, so that I can call imagettfbox with a font size that will result in a box of 100 pixels height (or any other size for that matter)?

  • 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-26T09:14:32+00:00Added an answer on May 26, 2026 at 9:14 am

    Different fonts will render at different sizes for the same size parameter. You need to call imagettfbbox over a range of text sizes until you find a size with the bounding box you like.

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

Sidebar

Related Questions

I have been using this simple script to generate images from text: <?php header('Content-type:
I have a script that generates images from text using PHP. It's working fine
I generate some images using a PHP lib. Sometimes the browser does not load
I'm looking to generate PHP images on the fly. So far I'm using this
I am using PHP to generate images and this works fine. I am having
I'm using PHP to generate feeds, which is working perfectly fine on my local
I'm using a compination of actionscript's getPixel and php's imagecreatetruecolor and imagesetpixel to generate
I'm trying to wrtie a facebook application that generates random quotes using php. However,
I am using PHP to generate 10 forms on a page which attach an
I've read several helpful answers in re. image resizing using PHP and max-height etc.:

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.