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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:36:51+00:00 2026-05-27T22:36:51+00:00

I am using xampp-win32-1.7.1-installer as server & Dreamwaver cs5 for coding. I want to

  • 0

I am using “xampp-win32-1.7.1-installer” as server & Dreamwaver cs5 for coding. I want to enable php GD support. I saw the

phpinfo();

there is showing GD support is enable. But it still doesn’t work. I don’t know why it doesn’t work? What should I do?

Well, actually i want to create an image with php. There is text box & submit button. When i give an input & press submit, it appears in that image box. It can do in many others platform but this time i want to do it in php.

here is my code :

<?php
header("Content-type: image/jpeg");
?>
<form action="Creating_Images_with_PHP.php" method="get">
<input type="text" name="name" />
    <input type="submit" value="Enter" />
</form>

<?php
$name = $_GET['name'];
$message = "Welcome to php academy, $name";

$length = strlen($message) * 9.3;

$image = imagecreate($length, 20);
$background = imagecolorallocate($image, 0, 0, 0);
$foreground = imagecolorallocate($image, 255, 255, 255);

imagestring($image, 5,5,1, $message, $foreground);

imagejpeg($image)
?>

and the showing error is :

"The image http://localhost/www/...blaa blaa blaa cannot be displayed because it contains errors."
  • 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-27T22:36:52+00:00Added an answer on May 27, 2026 at 10:36 pm

    your outputting the image as raw data. Thats ok, but your also sending out html code, thus corrupting your image.

    To start with you need to separate the two, and this should produce what you need assuming your existing php code works.

    something.html

    <form action="Creating_Images_with_PHP.php" method="get">
    <input type="text" name="name" />
        <input type="submit" value="Enter" />
    </form>
    

    Creating_Images_with_PHP.php

    <?php
    
    header("Content-type: image/jpeg");
    
    $name = $_GET['name'];
    $message = "Welcome to php academy, $name";
    
    $length = strlen($message) * 9.3;
    
    $image = imagecreate($length, 20);
    $background = imagecolorallocate($image, 0, 0, 0);
    $foreground = imagecolorallocate($image, 255, 255, 255);
    
    imagestring($image, 5,5,1, $message, $foreground);
    
    imagejpeg($image)
    ?>
    

    Once you’ve tested that you can work on making the script and html code live in the same file. You do this by checking the request information from your name field:

    if(isset($_GET['name'][1])){
        /* generate image */
    }else{
        /* output form */
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi im using xampp & I am trying to connect using php. <?php $server
I am using xampp on Windows Vista. I want to run a php script
I'm using XAMPP Server 1.7.7 While opening the php file, i receive the error
I was using xampp to develop locally and then I installed the PHP from
I am using XAMPP on a localhost windows VISTA m/c...using gmail as smpt server
I'm using XAMPP (latest version) on OS 10.6.2, that's bundled with PHP 5.3.0 I
I want to send a mail from localhost. I am using XAMPP to develop
I'm using xampp for my php. And I have download a code igniter and
I am using XAMPP to create php projects. My system is: name=con7 and local
I'm using Netbeans 7.0.1 in a PHP project. I've installed XAMPP 1.7 in Windows

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.