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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:36:54+00:00 2026-05-28T01:36:54+00:00

I am using PHP to generate images and this works fine. I am having

  • 0

I am using PHP to generate images and this works fine. I am having trouble displaying these images however:

My image generator is a PHP file that takes tons of parameters and loads of data to generate the image. Because of the excessive amounts that has to be passed to the generator, using the GET container does not work for me, so the data is sent via a POST request. The result of this request is the raw image data.

I am using

$result = post_request('http://myurl.com/graphx/generator.php', $data);
if($result['status'] == 'ok') {
    echo "<img src=\"data:image/png;base64,".
        base64_encode($result['content'])."\"/>\n";
}

to display my image. This works for very small images, but as they get bigger (300px*300px for example), the image is not displayed anymore (it seems to be cut somewhere).

Is my approach reasonable?

Is there any workaround for the size issue?

Update:

When I let the generator save the image to a file, the created file contains the image as I want it to be. Also, if convert my generator into a GET-generator, the following code works properly as well:

$data = http_build_query($data);
echo "<img src=\"http://myurl.com/graphx/get_generator.php?{$data}\"/>\n";

So it definitely seems to be a problem with either the POST request, or the conversion into the base64 format. I’m using the POST request as shown here.

  • 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-28T01:36:54+00:00Added an answer on May 28, 2026 at 1:36 am

    I’d suggest having your page be structured like this:

    main page:

    <img src="imageproxy.php" />
    

    imageproxy.php:

    <?php
    $result = post_request('http://myurl.com/graphx/generator.php', $data);
    header('Content-type: image/png');
    if($result['status'] == 'ok') {
        echo $result['content']);
    } else {
        readfile('error_message_image.png');
    }
    

    instead of trying to work with data uris and length limits, just have your proxy script output the actual raw image data and treat it as an image in your client-side html.

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

Sidebar

Related Questions

I am creating an image via a php script using imagepng. This works fine
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'm using PHP to generate feeds, which is working perfectly fine on my local
I'm using a PHP script to generate an excel CSV file from a result-set
I am using the following code to generate excel from sql through php.this is
I m using shadowbox.js for image gallery display. for this we have to generate
I actually want to generate random password using PHP uniqid() function $randomPassword = uniqid();
I am using CherryPy to generate and parse data for a php webpage, but
Im using http://www.ashberg.de/php-barcode/ scripts to generate a barcode. I now need to import the

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.