mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Porting Aid for dealing with the problem that some PHP's have ImageGIF(), others have ImagePNG()
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@34111 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
a4c5921206
commit
9b53d281d7
1 changed files with 27 additions and 0 deletions
|
@ -1058,6 +1058,33 @@ function LoadPNG ($imgname) {
|
|||
<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>
|
||||
|
|
Loading…
Reference in a new issue