cvs: phpdoc /en/functions image.xml
| From: | Martin Kraemer | Date: | Thu, 19 Oct 2000 09:23:47 +0000 |
| Subject: | cvs: phpdoc /en/functions image.xml | ||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969332550@lists.php.net to get a copy of this message | ||
martin Thu Oct 19 02:23:47 2000 EDT
Modified files:
/phpdoc/en/functions image.xml
Log:
Porting Aid for dealing with the problem that some PHP's have ImageGIF(), others have
ImagePNG()
Index: phpdoc/en/functions/image.xml
diff -u phpdoc/en/functions/image.xml:1.24 phpdoc/en/functions/image.xml:1.25
--- phpdoc/en/functions/image.xml:1.24 Fri Sep 15 09:09:43 2000
+++ phpdoc/en/functions/image.xml Thu Oct 19 02:23:47 2000
@@ -1058,6 +1058,33 @@
<acronym>GD</acronym> library in version 1.6, this function is
not available if you are using that version of the GD library.
</para>
+ <para>
+ The following code snippet allows you to write more
+ portable PHP applications by auto-detecting the
+ type of GD support which is available. Replace
+ the sequence <literal>Header("Content-type: image/gif");
+ ImageGif($im);</literal> by the more flexible sequence:
+ <informalexample>
+ <programlisting role="php">
+<?php
+ if(function_exists("imagegif")) {
+ Header("Content-type: image/gif");
+ ImageGif($im);
+ }
+ elseif(function_exists("imageJpeg")) {
+ Header("Content-type: image/jpeg");
+ ImageJpeg($im, "", 0.5);
+ }
+ elseif(function_exists("imagePng")) {
+ Header("Content-type: image/png");
+ ImagePng($im);
+ }
+ else
+ die("No image support in this PHP server");
+?>
+ </programlisting>
+ </informalexample>
+ </para>
</note>
</para>
</refsect1>