What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Assistance with PHP and GD

Assistance with PHP and GD
Author: Message:
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: Assistance with PHP and GD
In fact, that's very easy to do. :) You can use the Output Control Functions of PHP for this.
  1. Start buffering the output by calling:
    code:
    ob_start();
  2. Then, let imagepng() send the image to the output. Instead of getting printed, PHP will store it in the output buffer.
    code:
    imagepng($main_image);
  3. Now, you read what imagepng() has outputted with ob_get_flush(). This function gives you the output AND stops the output buffering, so basically it's does the same as ob_get_contents() and ob_end_flush() together, which is interesting in our case.
    code:
    $png_output = ob_get_flush();
  4. Yay, you have a variable containing the PNG output! :D You can now save it to a file and send the PNG output to the browser after all, by simply print()ing it. Don't forget your headers! ;)
Link: Comment by trucex on PHP: Output Control.

Argh, beaten by WDZ... the shame... :P

This post was edited on 02-21-2008 at 07:23 PM by Matti.
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
02-21-2008 07:22 PM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Assistance with PHP and GD - by MeEtc on 02-21-2008 at 06:57 PM
RE: Assistance with PHP and GD - by WDZ on 02-21-2008 at 07:18 PM
RE: Assistance with PHP and GD - by Matti on 02-21-2008 at 07:22 PM
RE: Assistance with PHP and GD - by MeEtc on 02-21-2008 at 07:34 PM
RE: Assistance with PHP and GD - by ShawnZ on 02-21-2008 at 09:00 PM
RE: Assistance with PHP and GD - by MeEtc on 02-21-2008 at 09:15 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On