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

  • SEARCH
  • Home
  • 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 6962467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:39:49+00:00 2026-05-27T15:39:49+00:00

Can anyone tell me why I can’t use the function imagettftext when I’m trying

  • 0

Can anyone tell me why I can’t use the function imagettftext when I’m trying to create a captcha? It works fine with imagestrings, but the font-size is to small so I have to use imagettftext… Is this a problem with Wamp or what is it? Thanks for your time!

PHP code(so far):

<?php
session_start();
header("Content-Type: image/png");

$text = $_SESSION['secure'];
$font_size = 30;

$image_width = 200;
$image_height = 40;

$image = imagecreate($image_width, $image_height);
imagecolorallocate($image, 255, 255, 255);
$text_color = imagecolorallocate($image, 0, 0, 0);

imagettftext($image, $font_size, 0, 15, 30, $text_color, 'arial.ttf', $text);
imagepng($image);
?>

Index.php:

<?php
session_start();
$_SESSION['secure'] = rand(1000,9999);
?>

<img src="createanimage.php" />
  • 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-27T15:39:50+00:00Added an answer on May 27, 2026 at 3:39 pm

    From what little info you’ve given, the code initially didn’t work for me, I changed the font path from arial.ttf to ./arial.ttf. It worked!

    An exact replica of your code: http://tekinozbek.net/so_imagettftext.php

    Beware some spammers use image analysis to recognize text paths and determine the CAPTCHA image! I would certainly suggest you use something like reCAPTCHA for better protection against spam.

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

Sidebar

Related Questions

Can anyone tell me if there are RDBMSs that allow me to create a
Can anyone tell me what syntax highlighting theme is in use here? http://jamierumbelow.net/images/code.png Jamie
Can anyone tell me please whats the easiest way to use Keychain to store
Can anyone tell me whether I can create a custom active security tokebn service
Can anyone tell me a code for next function, which raises EXCEPTION_FLT_STACK_CHECK or EXCEPTION_BREAKPOINT,
can anyone tell me whats the algorithm used for this function: http://stat.ethz.ch/R-manual/R-devel/library/utils/html/combn.html ? I
Can anyone tell me how can i create two business accounts? Actually, i want
can anyone tell me the function of following code. is the code line NSString*
Can anyone tell me how to use the Exception field of the Throw Activity?
Can anyone tell where i am wrong because its just a simple process but

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.