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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:44:11+00:00 2026-05-30T17:44:11+00:00

I am having hard time with php headers, i’m trying to create any kind

  • 0

I am having hard time with php headers, i’m trying to create any kind of image in my browser without saving it in a file, but no matter what i do i can’t get it working.

So for example if i use this basic example from php manual:

$im = imagecreate(100, 100);

header('Content-Type: image/png');

imagepng($im);
imagedestroy($im);

It would set correct header and even output that icon which u get when image is not found.

Also i use xampp which have GD enabled, here is my phpinfo GD part:

GD Support  enabled
GD Version  bundled (2.0.34 compatible)
FreeType Support    enabled
FreeType Linkage    with freetype
FreeType Version    2.4.3
GIF Read Support    enabled
GIF Create Support  enabled
JPEG Support    enabled
libJPEG Version 6b
PNG Support enabled
libPNG Version  1.2.46
WBMP Support    enabled
XBM Support enabled

Is my code is wrong or do i need to configure something?

  • 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-30T17:44:13+00:00Added an answer on May 30, 2026 at 5:44 pm

    You should not only create the image but also fill it some way:

    error_reporting(E_ALL);
    ini_set('display_errors', 1);
    
    $im = imagecreate(100, 100) or die("Cannot Initialize new GD image stream");
    $background_color = imagecolorallocate($im, 0, 0, 0);
    
    header('Content-Type: image/png');
    
    imagepng($im);
    imagedestroy($im);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

im having a hard time saving the image captured from the webcam using the
I'm having hard time trying to figure out how to auto-save user data in
I've been having a hard time trying to understand PyPy's translation. It looks like
I'm having a hard time trying to figure it out how to organize the
I'm having a hard time with .htaccess. I want to create friendly URLs for
I'm having a hard time understanding the PHP control structure declare() and where/how it
im having hard time with this one, i want to create folder with write
Still having a hard time grasping some of the harder templates any help would
I'm having hard time consuming a secure WCF Web Service from a PHP site.
I'm having hard time trying to use teasers post in my wordpress theme (based

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.