mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-26 22:08:55 +00:00

- (Created missing setup sections in setup.xml, if any) - Moved the intro to book.xml - Changed the intro ID from <extname>.intro to intro.<extname> - Moved the constants entity to book.xml - Changed constants.xml to be an appendix - Moved the examples to examples.xml NOTE: The chapter has the ID 'image.examples', the orginal 'image.examples' example is now 'image.examples-png' - Moved the requirements and resources sections to setup.xml - Moved the configure and ini entities to setup.xml git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@248838 c90b9560-bf6c-de11-be94-00142212c4b1
59 lines
1.6 KiB
XML
59 lines
1.6 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision: 1.2 $ -->
|
|
|
|
<chapter xml:id="image.examples" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
&reftitle.examples;
|
|
<section xml:id="image.examples-png">
|
|
<para>
|
|
<example>
|
|
<title>PNG creation with PHP</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
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);
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
This example would be called from a page with a tag like: <img
|
|
src="button.php?text=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>
|
|
</chapter>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"../../../manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|
|
|