[Webinar] Streamline your web hosting managementRegister Today


Write An Image Created By A Charting Class To A Bitmap File

Posted on 2004-10-29
Medium Priority
Last Modified: 2009-12-21

I have a barchart created by the chartdirector program available as a stream of bits that I then print using the print php statement, viz.:


With the makechartChart2 being the operation of the barcharting class.

I do not have the GD graphics library loaded but need to find some way to save the stream of bits as a file so that I can later make it available to a class (part of the fpdf library) that can insert the image as a picture in a pdf document.

Does anybody have a solution.?

Help would be appreciated.
Question by:phpamble
LVL 48

Accepted Solution

hernst42 earned 1400 total points
ID: 12447021
If you print the content, why not just saving the content to a variable like this:
$pic = $c->makeChart2(PNG);

// output bits
print $pic;

//write pic to file:
$fp = fopen('/name/of/pic.png', 'w+');
fputs($fp, $pic);

Author Comment

ID: 12480064

Thank you very much for your excellent assistance.  I also increased the point value for this question.

Featured Post

[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

612 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question