note 102740 deleted from image.examples-png by danbrown

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
Note Submitter: John D 

----

The current example fails unless the "button1.png" file is located.

I modified the example to account for this:

<?php

if (file_exists("images/button1.png")){

        header("Content-type: image/png");
        $string = $_GET['text'];
        $im     = imagecreatefrompng("images/button1.png");
        $orange = imagecolorallocate($im, 220, 210, 60);
        $px     = (imagesx($im) - 7.5 * strlen($string)) / 2;

        imagestring ($im, 3, $px, 9, $string, $orange);
        imagepng($im);
        imagedestroy($im);
} else {

        print ("File not fount, exiting...");
}

?>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.