mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 08:58:56 +00:00
integration from features/images.xml
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@98882 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
762a9325ce
commit
2b0530daba
1 changed files with 41 additions and 2 deletions
|
@ -1,12 +1,21 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
<reference id="ref.image">
|
||||
<title>Image functions</title>
|
||||
<titleabbrev>Image</titleabbrev>
|
||||
|
||||
<partintro>
|
||||
<section id="image.intro">
|
||||
&reftitle.intro;
|
||||
&reftitle.intro;
|
||||
<para>
|
||||
PHP is not limited to creating just HTML output. It can also be
|
||||
used to create and manipulate image files in a variety of different
|
||||
image formats, including gif, png, jpg, wbmp, and xpm. Even more
|
||||
convenient, PHP can output image streams directly to a browser. You
|
||||
will need to compile PHP with the GD library of image functions for
|
||||
this to work. GD and PHP may also require other libraries, depending
|
||||
on which image formats you want to work with.
|
||||
</para>
|
||||
<para>
|
||||
You can use the image functions in PHP to get the size of
|
||||
<acronym>JPEG</acronym>, <acronym>GIF</acronym>,
|
||||
|
@ -87,6 +96,36 @@
|
|||
|
||||
&reference.image.constants;
|
||||
|
||||
<section id="image.examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>PNG creation with PHP</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
header("Content-type: image/png");
|
||||
$string = implode($argv, " ");
|
||||
$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);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
This example would be called from a page with a tag like: <img
|
||||
src="button.php?text">. The above button.php script
|
||||
then takes this "text" string and overlays it on top of a
|
||||
base image which in this case is "images/button1.png"
|
||||
and outputs the resulting image. This is a very convenient way to
|
||||
avoid having to draw new button images every time you want to
|
||||
change the text of a button. With this method they are
|
||||
dynamically generated.
|
||||
</para>
|
||||
</section>
|
||||
</partintro>
|
||||
|
||||
&reference.image.functions;
|
||||
|
|
Loading…
Reference in a new issue