I wrote a small script to generate an image file containing a version number
for use in some web apps we are coding at work.  The problem is, that with
an up-to-date version of IE, the image shows up and can only be saved as a
BMP.  Older versions don't display it, but prompt for download and save it
correctly.  No problems in Mozilla (or presumably in Netscape 4.7x either).

Here's the script:

- - - - -
<?php
if(!(empty($version) && empty($product)))
{
header("Pragma: no-cache");
header("Cache-Control: no-cache, must-revalidate, max_age=0");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Expires: 0");
Header ("Content-type: image/png");

//-------------------------------------------------------------
// version.php
// creates new version image for TRS or i3100
// Parameters: $version (the name of the search)
//                         $product (the name of the product)
//-------------------------------------------------------------

// get all sizing information
$nAngle = 90;
$nFontSize = 11;
$sFontFile = "C:\WINNT\Fonts\arialbd.ttf";
$nVersionWidth = 15;
$nVersionHeight = 57;

// create the version image
$imgVersion = ImageCreate($nVersionWidth, $nVersionHeight);
switch($product)
{
        case "TRS":
                $cBackground = ImageColorAllocate($imgVersion, 0, 55, 104);
                $cText = ImageColorAllocate($imgVersion, 255, 255, 255);
                break;
        case "i3100":
                $cBackground = ImageColorAllocate($imgVersion, 51, 101,
102);
                $cText = ImageColorAllocate($imgVersion, 255, 255, 255);
                break;
}
ImageFilledRectangle($imgVersion, 0, 0, $nVersionWidth, $nVersionHeight,
$cBackground);
ImageTTFText($imgVersion, $nFontSize, $nAngle, 12, 53, $cText, $sFontFile,
$version);
if($bold = 1)
{
        ImageTTFText($imgVersion, $nFontSize, $nAngle, 12, 52, $cText,
$sFontFile, $version);
}

// send the version image to the browser
ImagePNG($imgVersion);

// free the version image from memory
ImageDestroy($imgVersion);
}
else
{
$version = "1.0.0";
?><html>
        <head>
                <title>TRS/i3100 Version Image Generator</title>
                <meta http-equiv="expires" content="0"/>
        </head>
        <body>
                <b>Web App Version Image Generator</b><br/>
                <form method="get" action="version.php">
                        <table border="0px" cellpadding="4px">
                                <tr>
                                        <td valign="top">
                                                Product:<br/>
                                                <input type="radio"
name="product" value="TRS" checked="true"/>&nbsp;TRS<br/>
                                                <input type="radio"
name="product" value="i3100"/>&nbsp;i3100<br/>
                                        </td>
                                        <td valign="top">
                                                Font Style:<br/>
                                                <input type="checkbox"
name="bold" value="1" checked="true"/>&nbsp;Bold<br/>
                                        </td>
                                </tr>
                                <tr>
                                        <td valign="middle" colspan="2">
                                                Version:&nbsp;<input
type="text" name="version" value="<?php echo("$version") ?>"
maxlength="9"/><br/>
                                        </td>
                                </tr>
                                <tr>
                                        <td valign="middle" align="right"
colspan="2">
                                                <input type="submit"
value="Submit"/>
                                        </td>
                                </tr>
                        </table>
                </form>
        </body>
</html>
<?php
}
?>
- - - - -

What do I need to do so it will save properly in ALL versions of IE?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to