File: image.xml

package info (click to toggle)
phpdoc 20020310-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 35,272 kB
  • ctags: 354
  • sloc: xml: 799,767; php: 1,395; cpp: 500; makefile: 200; sh: 140; awk: 51
file content (2188 lines) | stat: -rw-r--r-- 78,798 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
<?xml version="1.0" encoding="utf-8"?>
 <reference id="ref.image">
  <title>Image functions</title>
  <titleabbrev>Graphics</titleabbrev>

  <partintro>
   <simpara>
    You can use the image functions in PHP to get the size of
    <acronym>JPEG</acronym>, <acronym>GIF</acronym>,
    <acronym>PNG</acronym>, and <acronym>SWF</acronym> images, and if
    you have the <acronym>GD</acronym> library (available at <ulink
    url="&url.gd;">&url.gd;</ulink>) you will also be able to create
    and manipulate images.
   </simpara>
   <simpara>
    The format of images you are able to manipulate depend on the
    version of gd you install, and any other libraries gd might need
    to access those image formats. Versions of gd older than gd-1.6
    support gif format images, and do not support png, where versions
    greater than gd-1.6 support png, not gif.
   </simpara>
   <simpara>
    In order to read and write images in jpeg format, you will need to
    obtain and install jpeg-6b (available at 
    <ulink url="&url.jpeg;">&url.jpeg;</ulink>), and then recompile gd to
    make use of jpeg-6b. You will also have to compile PHP with 
    <option role="configure">--with-jpeg-dir=/path/to/jpeg-6b</option>.
   </simpara>
   <simpara>
    To add support for Type 1 fonts, you can install t1lib (available 
    at <ulink url="&url.t1lib;">&url.t1lib;</ulink>), and then add 
    <option role="configure">--with-t1lib[=dir]</option>.
   </simpara>
  </partintro>

  <refentry id="function.getimagesize">
   <refnamediv>
    <refname>GetImageSize</refname>
    <refpurpose>Get the size of a GIF, JPEG, PNG or SWF image</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>array</type><methodname>getimagesize</methodname>
      <methodparam><type>string</type><parameter>filename</parameter></methodparam>
      <methodparam choice="opt"><type>array</type><parameter>imageinfo</parameter></methodparam>
     </methodsynopsis>
    <para>
     The <function>GetImageSize</function> function will determine the
     size of any <acronym>GIF</acronym>, <acronym>JPG</acronym>,
     <acronym>PNG</acronym> or <acronym>SWF</acronym> image file and
     return the dimensions along with the file type and a height/width
     text string to be used inside a normal <acronym>HTML</acronym>
     <sgmltag>IMG</sgmltag> tag.
    </para>
    <para>
     Returns an array with 4 elements.  Index 0 contains the width of
     the image in pixels.  Index 1 contains the height.  Index 2 a
     flag indicating the type of the image.  1 = GIF, 2 = JPG, 3 =
     PNG, 4 = SWF.  Index 3 is a text string with the correct
     "height=xxx width=xxx" string that can be used directly in an IMG
     tag.
     <example>
      <title>GetImageSize</title>
      <programlisting role="php">
&lt;?php $size = GetImageSize ("img/flag.jpg"); ?>
&lt;IMG SRC="img/flag.jpg" &lt;?php echo $size[3]; ?>
      </programlisting>
     </example>
    </para>
    <para>
     The optional <parameter>imageinfo</parameter> parameter allows
     you to extract some extended information from the image
     file. Currently this will return the diffrent
     <acronym>JPG</acronym> APP markers in an associative Array. Some
     Programs use these APP markers to embedd text information in
     images. A very common one in to embed <acronym>IPTC</acronym>
     <ulink url="&url.iptc;">&url.iptc;</ulink> information in the
     APP13 marker. You can use the <function>iptcparse</function>
     function to parse the binary APP13 marker into something
     readable.
     <example>
      <title>GetImageSize returning IPTC</title>
      <programlisting>
&lt;?php 
    $size = GetImageSize ("testimg.jpg",&amp;$info);
    if (isset ($info["APP13"])) {
        $iptc = iptcparse ($info["APP13"]);
        var_dump ($iptc);
    }
?&gt;
      </programlisting>
     </example>
     <note>
      <simpara>
       This function does not require the GD image library.
      </simpara>
     </note>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagearc">
   <refnamediv>
    <refname>ImageArc</refname>
    <refpurpose>Draw a partial ellipse</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imagearc</methodname>
      <methodparam><type>int</type><parameter>im</parameter></methodparam>
      <methodparam><type>int</type><parameter>cx</parameter></methodparam>
      <methodparam><type>int</type><parameter>cy</parameter></methodparam>
      <methodparam><type>int</type><parameter>w</parameter></methodparam>
      <methodparam><type>int</type><parameter>h</parameter></methodparam>
      <methodparam><type>int</type><parameter>s</parameter></methodparam>
      <methodparam><type>int</type><parameter>e</parameter></methodparam>
      <methodparam><type>int</type><parameter>col</parameter></methodparam>
     </methodsynopsis>
    <para>
     <function>ImageArc</function> draws a partial ellipse centered at
     <parameter>cx</parameter>, <parameter>cy</parameter> (top left is
     0, 0) in the image represented by im.  <parameter>W</parameter>
     and <parameter>h</parameter> specifies the ellipse's width and
     height respectively while the start and end points are specified
     in degrees indicated by the <parameter>s</parameter> and
     <parameter>e</parameter>.  arguments.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagechar">
   <refnamediv>
    <refname>ImageChar</refname>
    <refpurpose>Draw a character horizontally</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imagechar</methodname>
      <methodparam><type>int</type><parameter>im</parameter></methodparam>
      <methodparam><type>int</type><parameter>font</parameter></methodparam>
      <methodparam><type>int</type><parameter>x</parameter></methodparam>
      <methodparam><type>int</type><parameter>y</parameter></methodparam>
      <methodparam><type>string</type><parameter>c</parameter></methodparam>
      <methodparam><type>int</type><parameter>col</parameter></methodparam>
     </methodsynopsis>
    <para>
     <function>ImageChar</function> draws the first character of
     <parameter>c</parameter> in the image identified by
     <parameter>id</parameter> with its upper-left at
     <parameter>x</parameter>,<parameter>y</parameter> (top left is 0,
     0) with the color <parameter>col</parameter>. If font is 1, 2, 3,
     4 or 5, a built-in font is used (with higher numbers
     corresponding to larger fonts).
    </para>
    <para>
     See also <function>imageloadfont</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagecharup">
   <refnamediv>
    <refname>ImageCharUp</refname>
    <refpurpose>Draw a character vertically</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imagecharup</methodname>
      <methodparam><type>int</type><parameter>im</parameter></methodparam>
      <methodparam><type>int</type><parameter>font</parameter></methodparam>
      <methodparam><type>int</type><parameter>x</parameter></methodparam>
      <methodparam><type>int</type><parameter>y</parameter></methodparam>
      <methodparam><type>string</type><parameter>c</parameter></methodparam>
      <methodparam><type>int</type><parameter>col</parameter></methodparam>
     </methodsynopsis>
    <para> 
     <function>ImageCharUp</function> draws the character
     <parameter>c</parameter> vertically in the image identified by
     <parameter>im</parameter> at coordinates
     <parameter>x</parameter>, <parameter>y</parameter> (top left is
     0, 0) with the color <parameter>col</parameter>.  If font is 1,
     2, 3, 4 or 5, a built-in font is used.
    </para>
    <para>    
     See also <function>imageloadfont</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagecolorallocate">
   <refnamediv>
    <refname>ImageColorAllocate</refname>
    <refpurpose>Allocate a color for an image</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imagecolorallocate</methodname>
      <methodparam><type>int</type><parameter>im</parameter></methodparam>
      <methodparam><type>int</type><parameter>red</parameter></methodparam>
      <methodparam><type>int</type><parameter>green</parameter></methodparam>
      <methodparam><type>int</type><parameter>blue</parameter></methodparam>
     </methodsynopsis>
    <para>
     <function>ImageColorAllocate</function> returns a color
     identifier representing the color composed of the given
     <acronym>RGB</acronym> components.  The <parameter>im</parameter>
     argument is the return from the <function>imagecreate</function>
     function.  <function>ImageColorAllocate</function> must be called
     to create each color that is to be used in the image represented
     by <parameter>im</parameter>.
     <informalexample>
      <programlisting role="php">
$white = ImageColorAllocate ($im, 255, 255, 255);
$black = ImageColorAllocate ($im, 0, 0, 0);
      </programlisting>
     </informalexample>
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.imagecolordeallocate">
   <refnamediv>
    <refname>ImageColorDeAllocate</refname>
    <refpurpose>
     De-allocate a color for an image
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imagecolordeallocate</methodname>
      <methodparam><type>int</type><parameter>im</parameter></methodparam>
      <methodparam><type>int</type><parameter>index</parameter></methodparam>
     </methodsynopsis>
    <para>
     The <function>ImageColorDeAllocate</function> function
     de-allocates a color previously allocated with the
     <function>ImageColorAllocate</function> function.
     <informalexample>
      <programlisting role="php">
$white = ImageColorAllocate($im, 255, 255, 255);
ImageColorDeAllocate($im, $white);
      </programlisting>
     </informalexample>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagecolorat">
   <refnamediv>
    <refname>ImageColorAt</refname>
    <refpurpose>Get the index of the color of a pixel</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imagecolorat</methodname>
      <methodparam><type>int</type><parameter>im</parameter></methodparam>
      <methodparam><type>int</type><parameter>x</parameter></methodparam>
      <methodparam><type>int</type><parameter>y</parameter></methodparam>
     </methodsynopsis>
    <para>
     Returns the index of the color of the pixel at the
     specified location in the image.
    </para>
    <para>
     See also <function>imagecolorset</function> and
     <function>imagecolorsforindex</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagecolorclosest">
   <refnamediv>
    <refname>ImageColorClosest</refname>
    <refpurpose>
     Get the index of the closest color to the specified color
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imagecolorclosest</methodname>
      <methodparam><type>int</type><parameter>im</parameter></methodparam>
      <methodparam><type>int</type><parameter>red</parameter></methodparam>
      <methodparam><type>int</type><parameter>green</parameter></methodparam>
      <methodparam><type>int</type><parameter>blue</parameter></methodparam>
     </methodsynopsis>
    <para>
     Returns the index of the color in the palette of the image which
     is "closest" to the specified <acronym>RGB</acronym> value.
    </para>
    <para>
     The "distance" between the desired color and each color in the
     palette is calculated as if the <acronym>RGB</acronym> values
     represented points in three-dimensional space.
    </para>
    <para>
     See also <function>imagecolorexact</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagecolorexact">
   <refnamediv>
    <refname>ImageColorExact</refname>
    <refpurpose>Get the index of the specified color</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imagecolorexact</methodname>
      <methodparam><type>int</type><parameter>im</parameter></methodparam>
      <methodparam><type>int</type><parameter>red</parameter></methodparam>
      <methodparam><type>int</type><parameter>green</parameter></methodparam>
      <methodparam><type>int</type><parameter>blue</parameter></methodparam>
     </methodsynopsis>
    <para>
     Returns the index of the specified color in the palette of the
     image.
    </para>
    <para>
     If the color does not exist in the image's palette, -1 is
     returned.
    </para>
    <para>
     See also <function>imagecolorclosest</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagecolorresolve">
   <refnamediv>
    <refname>ImageColorResolve</refname>
    <refpurpose>
     Get the index of the specified color or its closest possible
     alternative
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imagecolorresolve</methodname>
      <methodparam><type>int</type><parameter>im</parameter></methodparam>
      <methodparam><type>int</type><parameter>red</parameter></methodparam>
      <methodparam><type>int</type><parameter>green</parameter></methodparam>
      <methodparam><type>int</type><parameter>blue</parameter></methodparam>
     </methodsynopsis>
    <para>
     This function is guaranteed to return a color index for a
     requested color, either the exact color or the closest possible
     alternative.
    </para>
    <para>
     See also <function>imagecolorclosest</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagegammacorrect">
   <refnamediv>
    <refname>ImageGammaCorrect</refname>
    <refpurpose>
     Apply a gamma correction to a GD image
    </refpurpose>
    </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imagegammacorrect</methodname>
      <methodparam><type>int</type><parameter>im</parameter></methodparam>
      <methodparam><type>double</type><parameter>inputgamma</parameter></methodparam>
      <methodparam><type>double</type><parameter>outputgamma</parameter></methodparam>
     </methodsynopsis>
    <para>
     The <function>ImageGammaCorrect</function> function applies gamma
     correction to a gd image stream (<parameter>im</parameter>) given
     an input gamma, the parameter <parameter>inputgamma</parameter>
     and an output gamma, the parameter
     <parameter>outputgamma</parameter>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagecolorset">
   <refnamediv>
    <refname>ImageColorSet</refname>
    <refpurpose>
     Set the color for the specified palette index
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>bool</type><methodname>imagecolorset</methodname>
      <methodparam><type>int</type><parameter>im</parameter></methodparam>
      <methodparam><type>int</type><parameter>index</parameter></methodparam>
      <methodparam><type>int</type><parameter>red</parameter></methodparam>
      <methodparam><type>int</type><parameter>green</parameter></methodparam>
      <methodparam><type>int</type><parameter>blue</parameter></methodparam>
     </methodsynopsis>
    <para>
     This sets the specified index in the palette to the specified
     color. This is useful for creating flood-fill-like effects in
     paletted images without the overhead of performing the actual
     flood-fill.
    </para>
    <para>
     See also <function>imagecolorat</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagecolorsforindex">
   <refnamediv>
    <refname>ImageColorsForIndex</refname>
    <refpurpose>Get the colors for an index</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>array</type><methodname>imagecolorsforindex</methodname>
      <methodparam><type>int</type><parameter>im</parameter></methodparam>
      <methodparam><type>int</type><parameter>index</parameter></methodparam>
     </methodsynopsis>
    <para>
     This returns an associative array with red, green, and blue keys
     that contain the appropriate values for the specified color
     index.
    </para>
    <para>
     See also <function>imagecolorat</function> and
     <function>imagecolorexact</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagecolorstotal">
   <refnamediv>
    <refname>ImageColorsTotal</refname>
    <refpurpose>
     Find out the number of colors in an image's palette
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imagecolorstotal</methodname>
      <methodparam><type>int</type><parameter>im</parameter></methodparam>
     </methodsynopsis>
    <para>
     This returns the number of colors in the specified image's
     palette.
    </para>
    <para>
     See also <function>imagecolorat</function> and
     <function>imagecolorsforindex</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagecolortransparent">
   <refnamediv>
    <refname>ImageColorTransparent</refname>
    <refpurpose>Define a color as transparent</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imagecolortransparent</methodname>
      <methodparam><type>int</type><parameter>im</parameter></methodparam>
      <methodparam choice="opt"><type>int</type><parameter>col</parameter></methodparam>
     </methodsynopsis>
    <para>
     <function>ImageColorTransparent</function> sets the transparent
     color in the <parameter>im</parameter> image to
     <parameter>col</parameter>.  <parameter>Im</parameter> is the
     image identifier returned by <function>ImageCreate</function> and
     <parameter>col</parameter> is a color identifier returned by
     <function>ImageColorAllocate</function>.
    </para>
    <para>
     The identifier of the new (or current, if none is specified)
     transparent color is returned.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagecopy">
   <refnamediv>
    <refname>ImageCopy</refname>
    <refpurpose>
     Copy part of an image
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>ImageCopy</methodname>
      <methodparam><type>int</type><parameter>dst_im</parameter></methodparam>
      <methodparam><type>int</type><parameter>src_im</parameter></methodparam>
      <methodparam><type>int</type><parameter>dst_x</parameter></methodparam>
      <methodparam><type>int</type><parameter>dst_y</parameter></methodparam>
      <methodparam><type>int</type><parameter>src_x</parameter></methodparam>
      <methodparam><type>int</type><parameter>src_y</parameter></methodparam>
      <methodparam><type>int</type><parameter>src_w</parameter></methodparam>
      <methodparam><type>int</type><parameter>src_h</parameter></methodparam>
     </methodsynopsis>
    <para>
     Copy a part of <parameter>src_im</parameter> onto
     <parameter>dst_im</parameter> starting at the x,y coordinates
     <parameter>src_x</parameter>, <parameter>src_y </parameter> with
     a width of <parameter>src_w</parameter> and a height of
     <parameter>src_h</parameter>.  The portion defined will be copied
     onto the x,y coordinates, <parameter>dst_x</parameter> and
     <parameter>dst_y</parameter>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagecopyresized">
   <refnamediv>
    <refname>ImageCopyResized</refname>
    <refpurpose>Copy and resize part of an image</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imagecopyresized</methodname>
      <methodparam><type>int</type><parameter>dst_im</parameter></methodparam>
      <methodparam><type>int</type><parameter>src_im</parameter></methodparam>
      <methodparam><type>int</type><parameter>dstX</parameter></methodparam>
      <methodparam><type>int</type><parameter>dstY</parameter></methodparam>
      <methodparam><type>int</type><parameter>srcX</parameter></methodparam>
      <methodparam><type>int</type><parameter>srcY</parameter></methodparam>
      <methodparam><type>int</type><parameter>dstW</parameter></methodparam>
      <methodparam><type>int</type><parameter>dstH</parameter></methodparam>
      <methodparam><type>int</type><parameter>srcW</parameter></methodparam>
      <methodparam><type>int</type><parameter>srcH</parameter></methodparam>
     </methodsynopsis>
    <para>
     <function>ImageCopyResized</function> copies a rectangular
     portion of one image to another image.
     <parameter>Dst_im</parameter> is the destination image,
     <parameter>src_im</parameter> is the source image identifier.  If
     the source and destination coordinates and width and heights
     differ, appropriate stretching or shrinking of the image fragment
     will be performed.  The coordinates refer to the upper left
     corner.  This function can be used to copy regions within the
     same image (if <parameter>dst_im</parameter> is the same as
     <parameter>src_im</parameter>) but if the regions overlap the
     results will be unpredictable.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagecreate">
   <refnamediv>
    <refname>ImageCreate</refname>
    <refpurpose>Create a new image</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imagecreate</methodname>
      <methodparam><type>int</type><parameter>x_size</parameter></methodparam>
      <methodparam><type>int</type><parameter>y_size</parameter></methodparam>
     </methodsynopsis>
    <para> 
     <function>ImageCreate</function> returns an image identifier
     representing a blank image of size <parameter>x_size</parameter>
     by <parameter>y_size</parameter>.
     <example>
      <title>
       Creating a new GD image stream and outputting an image.
      </title>
      <programlisting role="php">
&lt;?php
header ("Content-type: image/png");
$im = @ImageCreate (50, 100)
    or die ("Cannot Initialize new GD image stream");
$background_color = ImageColorAllocate ($im, 255, 255, 255);
$text_color = ImageColorAllocate ($im, 233, 14, 91);
ImageString ($im, 1, 5, 5,  "A Simple Text String", $text_color);
ImagePng ($im);
?>
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagecreatefromgif">
   <refnamediv>
    <refname>ImageCreateFromGIF</refname>
    <refpurpose>Create a new image from file or URL</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imagecreatefromgif</methodname>
      <methodparam><type>string</type><parameter>filename</parameter></methodparam>
     </methodsynopsis>
    <para>
     <function>ImageCreateFromGif</function> returns an image identifier
     representing the image obtained from the given filename.
    </para>
    <para> 
     <function>ImageCreateFromGif</function> returns an empty string
     on failure. It also outputs an error message, which unfortunately
     displays as a broken link in a browser.  To ease debugging the
     following example will produce an error GIF:
    <example>
     <title>
      Example to handle an error during creation (courtesy
      vic@zymsys.com)
     </title>
      <programlisting role="php">
function LoadGif ($imgname) {
    $im = @ImageCreateFromGIF ($imgname); /* Attempt to open */
    if (!$im) { /* See if it failed */
        $im = ImageCreate (150, 30); /* Create a blank image */
        $bgc = ImageColorAllocate ($im, 255, 255, 255);
        $tc  = ImageColorAllocate ($im, 0, 0, 0);
        ImageFilledRectangle ($im, 0, 0, 150, 30, $bgc); 
        /* Output an errmsg */
        ImageString($im, 1, 5, 5, "Error loading $imgname", $tc); 
    }
    return $im;
}
      </programlisting>
     </example>
     <note>
      <para>
       Since all GIF support was removed from the GD library in
       version 1.6, this function is not available if you are using
       that version of the GD library.
      </para>
     </note>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagecreatefromjpeg">
   <refnamediv>
    <refname>ImageCreateFromJPEG</refname>
    <refpurpose>Create a new image from file or URL</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imagecreatefromjpeg</methodname>
      <methodparam><type>string</type><parameter>filename</parameter></methodparam>
     </methodsynopsis>
    <para>
     <function>ImageCreateFromJPEG</function> returns an image identifier
     representing the image obtained from the given filename.
    </para>
    <para> 
     <function>ImagecreateFromJPEG</function> returns an empty string
     on failure. It also outputs an error message, which unfortunately
     displays as a broken link in a browser.  To ease debugging the
     following example will produce an error <acronym>JPEG</acronym>:
    <example>
     <title>
       Example to handle an error during creation (courtesy
       vic@zymsys.com )
      </title>
      <programlisting role="php">
function LoadJpeg ($imgname) {
    $im = @ImageCreateFromJPEG ($imgname); /* Attempt to open */
    if (!$im) { /* See if it failed */
        $im = ImageCreate (150, 30); /* Create a blank image */
        $bgc = ImageColorAllocate ($im, 255, 255, 255);
        $tc  = ImageColorAllocate ($im, 0, 0, 0);
        ImageFilledRectangle ($im, 0, 0, 150, 30, $bgc);
        /* Output an errmsg */
        ImageString ($im, 1, 5, 5, "Error loading $imgname", $tc); 
    }
    return $im;
}
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagecreatefrompng">
   <refnamediv>
    <refname>ImageCreateFromPNG</refname>
    <refpurpose>Create a new image from file or URL</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imagecreatefrompng</methodname>
      <methodparam><type>string</type><parameter>filename</parameter></methodparam>
     </methodsynopsis>
    <para>
     <function>ImageCreateFromPNG</function> returns an image identifier
     representing the image obtained from the given filename.
    </para>
    <para> 
     <function>ImageCreateFromPNG</function> returns an empty string
     on failure. It also outputs an error message, which unfortunately
     displays as a broken link in a browser.  To ease debugging the
     following example will produce an error <acronym>PNG</acronym>:
     <example>
      <title>
       Example to handle an error during creation (courtesy
       vic@zymsys.com)
      </title>
      <programlisting role="php">
function LoadPNG ($imgname) {
    $im = @ImageCreateFromPNG ($imgname); /* Attempt to open */
    if (!$im) { /* See if it failed */
        $im  = ImageCreate (150, 30); /* Create a blank image */
        $bgc = ImageColorAllocate ($im, 255, 255, 255);
        $tc  = ImageColorAllocate ($im, 0, 0, 0);
        ImageFilledRectangle ($im, 0, 0, 150, 30, $bgc);
        /* Output an errmsg */
        ImageString ($im, 1, 5, 5, "Error loading $imgname", $tc); 
    }
    return $im;
}
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagecreatefromwbmp">
   <refnamediv>
    <refname>ImageCreateFromWBMP</refname>
    <refpurpose>Create a new image from file or URL</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imagecreatefromwbmp</methodname>
      <methodparam><type>string</type><parameter>filename</parameter></methodparam>
     </methodsynopsis>
    <para>
     <function>ImageCreateFromWBMP</function> returns an image identifier
     representing the image obtained from the given filename.
    </para>
    <para> 
     <function>ImageCreateFromWBMP</function> returns an empty string
     on failure. It also outputs an error message, which unfortunately
     displays as a broken link in a browser.  To ease debugging the
     following example will produce an error <acronym>WBMP</acronym>:
     <example>
      <title>
       Example to handle an error during creation (courtesy
       vic@zymsys.com)
      </title>
      <programlisting role="php">
function LoadWBMP ($imgname) {
    $im = @ImageCreateFromWBMP ($imgname); /* Attempt to open */
    if (!$im) { /* See if it failed */
        $im  = ImageCreate (20, 20); /* Create a blank image */
        $bgc = ImageColorAllocate ($im, 255, 255, 255);
        $tc  = ImageColorAllocate ($im, 0, 0, 0);
        ImageFilledRectangle ($im, 0, 0, 10, 10, $bgc);
        /* Output an errmsg */
        ImageString ($im, 1, 5, 5, "Error loading $imgname", $tc); 
    }
    return $im;
}
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagecreatefromstring">
   <refnamediv>
    <refname>ImageCreateFromString</refname>
    <refpurpose>Create a new image from the image stream in the string</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imagecreatefromstring</methodname>
      <methodparam><type>string</type><parameter>image</parameter></methodparam>
     </methodsynopsis>
    <para>
     <function>ImageCreateFromString</function> returns an image identifier
     representing the image obtained from the given string.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagedashedline">
   <refnamediv>
    <refname>ImageDashedLine</refname>
    <refpurpose>Draw a dashed line</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imagedashedline</methodname>
      <methodparam><type>int</type><parameter>im</parameter></methodparam>
      <methodparam><type>int</type><parameter>x1</parameter></methodparam>
      <methodparam><type>int</type><parameter>y1</parameter></methodparam>
      <methodparam><type>int</type><parameter>x2</parameter></methodparam>
      <methodparam><type>int</type><parameter>y2</parameter></methodparam>
      <methodparam><type>int</type><parameter>col</parameter></methodparam>
     </methodsynopsis>
    <para>    
     <function>ImageDashedLine</function> draws a dashed line from
     <parameter>x1</parameter>, <parameter>y1</parameter> to
     <parameter>x2</parameter>, <parameter>y2</parameter> (top left is
     0, 0) in image <parameter>im</parameter> of color
     <parameter>col</parameter>.
    </para>
    <para>    
     See also <function>ImageLine</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagedestroy">
   <refnamediv>
    <refname>ImageDestroy</refname>
    <refpurpose>Destroy an image</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imagedestroy</methodname>
      <methodparam><type>int</type><parameter>im</parameter></methodparam>
     </methodsynopsis>
    <para>    
     <function>ImageDestroy</function> frees any memory associated
     with image <parameter>im</parameter>.  <parameter>Im</parameter>
     is the image identifier returned by the
     <function>ImageCreate</function> function.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagefill">
   <refnamediv>
    <refname>ImageFill</refname>
    <refpurpose>Flood fill</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imagefill</methodname>
      <methodparam><type>int</type><parameter>im</parameter></methodparam>
      <methodparam><type>int</type><parameter>x</parameter></methodparam>
      <methodparam><type>int</type><parameter>y</parameter></methodparam>
      <methodparam><type>int</type><parameter>col</parameter></methodparam>
     </methodsynopsis>
    <para>    
     <function>ImageFill</function> performs a flood fill starting at
     coordinate <parameter>x</parameter>, <parameter>y</parameter>
     (top left is 0, 0) with color <parameter>col</parameter> in the
     image <parameter>im</parameter>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagefilledpolygon">
   <refnamediv>
    <refname>ImageFilledPolygon</refname>
    <refpurpose>Draw a filled polygon</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imagefilledpolygon</methodname>
      <methodparam><type>int</type><parameter>im</parameter></methodparam>
      <methodparam><type>array</type><parameter>points</parameter></methodparam>
      <methodparam><type>int</type><parameter>num_points</parameter></methodparam>
      <methodparam><type>int</type><parameter>col</parameter></methodparam>
     </methodsynopsis>
    <para> 
     <function>ImageFilledPolygon</function> creates a filled polygon
     in image <parameter>im</parameter>.
     <parameter>Points</parameter> is a PHP array containing the
     polygon's vertices, ie. points[0] = x0, points[1] = y0, points[2]
     = x1, points[3] = y1, etc.  <parameter>Num_points</parameter> is
     the total number of vertices.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagefilledrectangle">
   <refnamediv>
    <refname>ImageFilledRectangle</refname>
    <refpurpose>Draw a filled rectangle</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imagefilledrectangle</methodname>
      <methodparam><type>int</type><parameter>im</parameter></methodparam>
      <methodparam><type>int</type><parameter>x1</parameter></methodparam>
      <methodparam><type>int</type><parameter>y1</parameter></methodparam>
      <methodparam><type>int</type><parameter>x2</parameter></methodparam>
      <methodparam><type>int</type><parameter>y2</parameter></methodparam>
      <methodparam><type>int</type><parameter>col</parameter></methodparam>
     </methodsynopsis>
    <para> 
     <function>ImageFilledRectangle</function> creates a filled
     rectangle of color <function>col</function> in image
     <parameter>im</parameter> starting at upper left coordinates
     <parameter>x1</parameter>, <parameter>y1</parameter> and ending
     at bottom right coordinates <parameter>x2</parameter>,
     <parameter>y2</parameter>.  0, 0 is the top left corner of the
     image.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagefilltoborder">
   <refnamediv>
    <refname>ImageFillToBorder</refname>
    <refpurpose>Flood fill to specific color</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imagefilltoborder</methodname>
      <methodparam><type>int</type><parameter>im</parameter></methodparam>
      <methodparam><type>int</type><parameter>x</parameter></methodparam>
      <methodparam><type>int</type><parameter>y</parameter></methodparam>
      <methodparam><type>int</type><parameter>border</parameter></methodparam>
      <methodparam><type>int</type><parameter>col</parameter></methodparam>
     </methodsynopsis>
    <para>    
     <function>ImageFillToBorder</function> performs a flood fill
     whose border color is defined by <parameter>border</parameter>.
     The starting point for the fill is <parameter>x</parameter>,
     <parameter>y</parameter> (top left is 0, 0) and the region is
     filled with color <parameter>col</parameter>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagefontheight">
   <refnamediv>
    <refname>ImageFontHeight</refname>
    <refpurpose>Get font height</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imagefontheight</methodname>
      <methodparam><type>int</type><parameter>font</parameter></methodparam>
     </methodsynopsis>
    <para>
     Returns the pixel height of a character in the specified font.
    </para>
    <para>
     See also <function>ImageFontWidth</function> and
     <function>ImageLoadFont</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagefontwidth">
   <refnamediv>
    <refname>ImageFontWidth</refname>
    <refpurpose>Get font width</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imagefontwidth</methodname>
      <methodparam><type>int</type><parameter>font</parameter></methodparam>
     </methodsynopsis>
    <para>    
     Returns the pixel width of a character in font.
    </para>
    <para> 
     See also <function>ImageFontHeight</function> and
     <function>ImageLoadFont</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagegif">
   <refnamediv>
    <refname>ImageGIF</refname>
    <refpurpose>Output image to browser or file</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imagegif</methodname>
      <methodparam><type>int</type><parameter>im</parameter></methodparam>
      <methodparam choice="opt"><type>string</type><parameter>filename</parameter></methodparam>
     </methodsynopsis>
    <para>
     <function>ImageGIF</function> creates the <acronym>GIF</acronym>
     file in filename from the image <parameter>im</parameter>. The
     <parameter>im</parameter> argument is the return from the
     <function>imagecreate</function> function.
    </para>
    <para>
     The image format will be <acronym>GIF87a</acronym> unless the
     image has been made transparent with
     <function>ImageColorTransparent</function>, in which case the
     image format will be <acronym>GIF89a</acronym>.
    </para>
    <para>
     The filename argument is optional, and if left off, the raw image
     stream will be output directly.  By sending an image/gif
     content-type using <function>header</function>, you can create a
     PHP script that outputs <acronym>GIF</acronym> images directly.
     <note>
      <para>
       Since all <acronym>GIF</acronym> support was removed from the
       <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">
&lt;?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);
  }
  elseif (function_exists("imagewbmp")) {
    Header("Content-type: image/vnd.wap.wbmp");
    ImageWBMP($im);
  }
  else
    die("No image support in this PHP server");
?&gt;
        </programlisting>
       </informalexample>
      </para>
     </note>
     <note>
      <para>
       As of version 3.0.18 and 4.0.2 you can use the function
       <function>imagetypes</function> in place of
       <function>function_exists</function> for checking
       the presence of the various supported image formats:
       <informalexample>
        <programlisting role="php">
if (ImageTypes() &amp; IMG_GIF) {
    Header("Content-type: image/gif");
    ImageGif($im);
}
elseif (ImageTypes() &amp; IMG_JPG) {
... etc.</programlisting>
       </informalexample>
      </para>
     </note>
    </para>
    <para>
     See also <function>ImagePNG</function>, <function>ImageWBMP</function>, 
     <function>ImageJPEG</function>, <function>ImageTypes</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagepng">
   <refnamediv>
    <refname>ImagePNG</refname>
    <refpurpose>
     Output a PNG image to either the browser or a file
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imagepng</methodname>
      <methodparam><type>int</type><parameter>im</parameter></methodparam>
      <methodparam choice="opt"><type>string</type><parameter>filename</parameter></methodparam>
     </methodsynopsis>
    <para>
     The <function>ImagePNG</function> outputs a GD image stream
     (<parameter>im</parameter>) in PNG format to standard output
     (usually the browser) or, if a filename is given by the
     <parameter>filename</parameter> it outputs the image to the file.
     <informalexample>
      <programlisting role="php">
&lt;?php
$im = ImageCreateFromPng("test.png");
ImagePng($im);
?>
      </programlisting>
     </informalexample>
    </para>
    <para>
     See also <function>ImageGIF</function>, <function>ImageWBMP</function>, 
     <function>ImageJPEG</function>, <function>ImageTypes</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagejpeg">
   <refnamediv>
    <refname>ImageJPEG</refname>
    <refpurpose>Output image to browser or file</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imagejpeg</methodname>
      <methodparam><type>int</type><parameter>im</parameter></methodparam>
      <methodparam choice="opt"><type>string</type><parameter>filename</parameter></methodparam>
      <methodparam choice="opt"><type>int</type><parameter>quality</parameter></methodparam>
     </methodsynopsis>
    <para>
     <function>ImageJPEG</function> creates the
     <acronym>JPEG</acronym> file in filename from the image
     <parameter>im</parameter>. The <parameter>im</parameter> argument
     is the return from the <function>ImageCreate</function> function.
    </para>
    <para>
     The filename argument is optional, and if left off, the raw image
     stream will be output directly.  To skip the filename argument in
     order to provide a quality argument just use an empty string
     ('').  By sending an image/jpeg content-type using
     <function>header</function>, you can create a PHP script that
     outputs JPEG images directly.
     <note>
      <para>
       JPEG support is only available in PHP if PHP was compiled
       against GD-1.8 or later.
      </para> 
     </note>
    </para>
    <para>
     See also <function>ImagePNG</function>, <function>ImageGIF</function>, 
     <function>ImageWBMP</function>, <function>ImageTypes</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagewbmp">
   <refnamediv>
    <refname>ImageWBMP</refname>
    <refpurpose>Output image to browser or file</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imageWBMP</methodname>
      <methodparam><type>int</type><parameter>im</parameter></methodparam>
      <methodparam choice="opt"><type>string</type><parameter>filename</parameter></methodparam>
     </methodsynopsis>
    <para>
     <function>ImageWBMP</function> creates the
     <acronym>WBMP</acronym> file in filename from the image
     <parameter>im</parameter>. The <parameter>im</parameter> argument
     is the return from the <function>ImageCreate</function> function.
    </para>
    <para>
     The filename argument is optional, and if left off, the raw image
     stream will be output directly. 
     By sending an <acronym>image/vnd.wap.wbmp</acronym> content-type 
     using <function>header</function>, you can create 
     a PHP script that outputs WBMP images directly.
     <note>
      <para>
       WBMP support is only available in PHP if PHP was compiled
       against GD-1.8 or later.
      </para> 
     </note>
    </para>
    <para>
     See also <function>ImagePNG</function>, <function>ImageGIF</function>, 
     <function>ImageJPEG</function>, <function>ImageTypes</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imageinterlace">
   <refnamediv>
    <refname>ImageInterlace</refname>
    <refpurpose>Enable or disable interlace</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imageinterlace</methodname>
      <methodparam><type>int</type><parameter>im</parameter></methodparam>
      <methodparam choice="opt"><type>int</type><parameter>interlace</parameter></methodparam>
     </methodsynopsis>
    <para>
     <function>ImageInterlace</function> turns the interlace bit on or off.
     If interlace is 1 the im image will be interlaced, and if interlace
     is 0 the interlace bit is turned off.
    </para>
    <para>
     This functions returns whether the interlace bit is set for the
     image.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imageline">
   <refnamediv>
    <refname>ImageLine</refname>
    <refpurpose>Draw a line</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imageline</methodname>
      <methodparam><type>int</type><parameter>im</parameter></methodparam>
      <methodparam><type>int</type><parameter>x1</parameter></methodparam>
      <methodparam><type>int</type><parameter>y1</parameter></methodparam>
      <methodparam><type>int</type><parameter>x2</parameter></methodparam>
      <methodparam><type>int</type><parameter>y2</parameter></methodparam>
      <methodparam><type>int</type><parameter>col</parameter></methodparam>
     </methodsynopsis>
    <para>    
     <function>ImageLine</function> draws a line from
     <parameter>x1</parameter>, <parameter>y1</parameter> to
     <parameter>x2</parameter>, <parameter>y2</parameter> (top left is
     0, 0) in image im of color <parameter>col</parameter>.  
    </para>
    <para> 
     See also <function>ImageCreate</function> and
     <function>ImageColorAllocate</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imageloadfont">
   <refnamediv>
    <refname>ImageLoadFont</refname>
    <refpurpose>Load a new font</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imageloadfont</methodname>
      <methodparam><type>string</type><parameter>file</parameter></methodparam>
     </methodsynopsis>
    <para>
     <function>ImageLoadFont</function> loads a user-defined bitmap
     font and returns an identifier for the font (that is always
     greater than 5, so it will not conflict with the built-in fonts).
    </para>
    <para>
     The font file format is currently binary and architecture
     dependent.  This means you should generate the font files on the
     same type of CPU as the machine you are running PHP on.
    </para>
    <para>
     <table>
      <title>Font file format</title>
      <tgroup cols="3">
       <thead>
	<row>
	 <entry>byte position</entry>
	 <entry>C data type</entry>
	 <entry>description</entry>
	</row>
       </thead>
       <tbody>
	<row>
	 <entry>byte 0-3</entry>
	 <entry>int</entry>
	 <entry>number of characters in the font</entry>
	</row>
	<row>
	 <entry>byte 4-7</entry>
	 <entry>int</entry>
	 <entry>
	  value of first character in the font (often 32 for space)
	 </entry>
	</row>
	<row>
	 <entry>byte 8-11</entry>
	 <entry>int</entry>
	 <entry>pixel width of each character</entry>
	</row>
	<row>
	 <entry>byte 12-15</entry>
	 <entry>int</entry>
	 <entry>pixel height of each character</entry>
	</row>
	<row>
	 <entry>byte 16-</entry>
	 <entry>char</entry>
	 <entry>
	  array with character data, one byte per pixel in each
	  character, for a total of (nchars*width*height) bytes.
	 </entry>
	</row>
       </tbody>
      </tgroup>
     </table>
    </para>
    <para>
     See also <function>ImageFontWidth</function> and
     <function>ImageFontHeight</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagepolygon">
   <refnamediv>
    <refname>ImagePolygon</refname>
    <refpurpose>Draw a polygon</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imagepolygon</methodname>
      <methodparam><type>int</type><parameter>im</parameter></methodparam>
      <methodparam><type>array</type><parameter>points</parameter></methodparam>
      <methodparam><type>int</type><parameter>num_points</parameter></methodparam>
      <methodparam><type>int</type><parameter>col</parameter></methodparam>
     </methodsynopsis>
    <para> 
     <function>ImagePolygon</function> creates a polygon in image id.
     <parameter>Points</parameter> is a PHP array containing the
     polygon's vertices, ie. points[0] = x0, points[1] = y0, points[2]
     = x1, points[3] = y1, etc.  <parameter>Num_points</parameter> is
     the total number of vertices.
    </para>
    <para> 
     See also <function>imagecreate</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagepsbbox">
   <refnamediv>
    <refname>ImagePSBBox</refname>
    <refpurpose>
     Give the bounding box of a text rectangle using PostScript Type1
     fonts
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>array</type><methodname>imagepsbbox</methodname>
      <methodparam><type>string</type><parameter>text</parameter></methodparam>
      <methodparam><type>int</type><parameter>font</parameter></methodparam>
      <methodparam><type>int</type><parameter>size</parameter></methodparam>
      <methodparam choice="opt"><type>int</type><parameter>space</parameter></methodparam>
      <methodparam choice="opt"><type>int</type><parameter>tightness</parameter></methodparam>
      <methodparam choice="opt"><type>float</type><parameter>angle</parameter></methodparam>
     </methodsynopsis>
    <para>
     <parameter>Size</parameter> is expressed in pixels.
    </para>
    <para>
     <parameter>Space</parameter> allows you to change the default
     value of a space in a font.  This amount is added to the normal
     value and can also be negative.
    </para>
    <para>
     <parameter>Tightness</parameter> allows you to control the amount
     of white space between characters. This amount is added to the
     normal character width and can also be negative.
    </para>
    <para>
     <parameter>Angle</parameter> is in degrees.
    </para>
    <para>
     Parameters <parameter>space</parameter> and
     <parameter>tightness</parameter> are expressed in character space
     units, where 1 unit is 1/1000th of an em-square.
    </para>
    <para>
     Parameters <parameter>space</parameter>,
     <parameter>tightness</parameter>, and <parameter>angle</parameter>
     are optional.
    </para>
    <para>
     The bounding box is calculated using information available from
     character metrics, and unfortunately tends to differ slightly
     from the results achieved by actually rasterizing the text. If
     the angle is 0 degrees, you can expect the text to need 1 pixel
     more to every direction.
    </para>
    <para>
     This function returns an array containing the following elements:
     <informaltable>
      <tgroup cols="2">
       <tbody>
	<row>
	 <entry>0</entry>
	 <entry>lower left x-coordinate</entry>
	</row>
	<row>
	 <entry>1</entry>
	 <entry>lower left y-coordinate</entry>
	</row>
	<row>
	 <entry>2</entry>
	 <entry>upper right x-coordinate</entry>
	</row>
	<row>
	 <entry>3</entry>
	 <entry>upper right y-coordinate</entry>
	</row>
       </tbody>
      </tgroup>
     </informaltable>
    </para>
    <para>
     See also <function>imagepstext</function>.
    </para>
   </refsect1>
  </refentry>

<!-- The function in t1lib which this function uses seems to be buggy...
Currently, just comment out everywhere in the docs and source until time
permits to find a solution.

  <refentry id="function.imagepscopyfont">
   <refnamediv>
    <refname>ImagePSCopyFont</refname>
    <refpurpose>
     Make a copy of an already loaded font for further modification
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imagepscopyfont</methodname>
      <methodparam><type>int</type><parameter>fontindex</parameter></methodparam>
     </methodsynopsis>
    <para>
     Use this function if you need make further modifications to the
     font, for example extending/condensing, slanting it or changing
     it's character encoding vector, but need to keep the original
     along as well. Note that the font you want to copy must be one
     obtained using <function>ImagePSLoadFont</function>, not a font
     that is itself a copied one. You can although make modifications
     to it before copying.
    </para>
    <para>
     If you use this function, you <emphasis>must</emphasis> free the
     fonts obtained this way yourself and in reverse order. Otherwise
     your script <emphasis>will</emphasis> hang.
    </para>
    <para>
     In the case everything went right, a valid font index will be
     returned and can be used for further purposes. Otherwise the
     function returns &false; and prints a message describing what went
     wrong.
    </para>
    <para>
     See also <function>ImagePSLoadFont</function>.
    </para>
   </refsect1>
  </refentry>
-->

  <refentry id="function.imagepsencodefont">
   <refnamediv>
    <refname>ImagePSEncodeFont</refname>
    <refpurpose>
     Change the character encoding vector of a font
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imagepsencodefont</methodname>
      <methodparam><type>int</type><parameter>font_index</parameter></methodparam>
      <methodparam><type>string</type><parameter>encodingfile</parameter></methodparam>
     </methodsynopsis>
    <para>
     Loads a character encoding vector from from a file and changes
     the fonts encoding vector to it. As a PostScript fonts default
     vector lacks most of the character positions above 127, you'll
     definitely want to change this if you use an other language than
     english. The exact format of this file is described in T1libs
     documentation. T1lib comes with two ready-to-use files,
     IsoLatin1.enc and IsoLatin2.enc.
    </para>
    <para>
     If you find yourself using this function all the time, a much
     better way to define the encoding is to set ps.default_encoding in
     the <link linkend="configuration.file">configuration file</link>
     to point to the right encoding file and all fonts you load will
     automatically have the right encoding.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagepsfreefont">
   <refnamediv>
    <refname>ImagePSFreeFont</refname>
    <refpurpose>Free memory used by a PostScript Type 1 font</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>void</type><methodname>imagepsfreefont</methodname>
      <methodparam><type>int</type><parameter>fontindex</parameter></methodparam>
     </methodsynopsis>
    <para>
     See also <function>ImagePSLoadFont</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagepsloadfont">
   <refnamediv>
    <refname>ImagePSLoadFont</refname>
    <refpurpose>Load a PostScript Type 1 font from file</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imagepsloadfont</methodname>
      <methodparam><type>string</type><parameter>filename</parameter></methodparam>
     </methodsynopsis>
    <para>
     In the case everything went right, a valid font index will be
     returned and can be used for further purposes. Otherwise the
     function returns &false; and prints a message describing what went
     wrong.
    </para>
    <para>
     See also <function>ImagePSFreeFont</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagepsextendfont">
   <refnamediv>
    <refname>ImagePsExtendFont</refname>
    <refpurpose>
     Extend or condense a font
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>bool</type><methodname>imagepsextendfont</methodname>
      <methodparam><type>int</type><parameter>font_index</parameter></methodparam>
      <methodparam><type>double</type><parameter>extend</parameter></methodparam>
     </methodsynopsis>
    <para>
     Extend or condense a font (<parameter>font_index</parameter>), if
     the value of the <parameter>extend</parameter> parameter is less
     than one you will be condensing the font.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.imagepsslantfont">
   <refnamediv>
    <refname>ImagePsSlantFont</refname>
    <refpurpose>
     Slant a font
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>bool</type><methodname>imagepsslantfont</methodname>
      <methodparam><type>int</type><parameter>font_index</parameter></methodparam>
      <methodparam><type>double</type><parameter>slant</parameter></methodparam>
     </methodsynopsis>
    <para>
     Slant a font given by the <parameter>font_index</parameter>
     parameter with a slant of the value of the
     <parameter>slant</parameter> parameter.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagepstext">
   <refnamediv>
    <refname>ImagePSText</refname>
    <refpurpose>
     To draw a text string over an image using PostScript Type1 fonts
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>array</type><methodname>imagepstext</methodname>
      <methodparam><type>int</type><parameter>image</parameter></methodparam>
      <methodparam><type>string</type><parameter>text</parameter></methodparam>
      <methodparam><type>int</type><parameter>font</parameter></methodparam>
      <methodparam><type>int</type><parameter>size</parameter></methodparam>
      <methodparam><type>int</type><parameter>foreground</parameter></methodparam>
      <methodparam><type>int</type><parameter>background</parameter></methodparam>
      <methodparam><type>int</type><parameter>x</parameter></methodparam>
      <methodparam><type>int</type><parameter>y</parameter></methodparam>
      <methodparam choice="opt"><type>int</type><parameter>
        space
       </parameter></methodparam>
      <methodparam choice="opt"><type>int</type><parameter>
        tightness
       </parameter></methodparam>
      <methodparam choice="opt"><type>float</type><parameter>
        angle
       </parameter></methodparam>
      <methodparam choice="opt"><type>int</type><parameter>
        antialias_steps
       </parameter></methodparam>
     </methodsynopsis>
    <para>
     <parameter>Size</parameter> is expressed in pixels.
    </para>
    <para>
     <parameter>Foreground</parameter> is the color in which the text
     will be painted.  <parameter>Background</parameter> is the color
     to which the text will try to fade in with antialiasing. No
     pixels with the color <parameter>background</parameter> are
     actually painted, so the background image does not need to be of
     solid color.
    </para>
    <para>
     The coordinates given by <parameter>x</parameter>,
     <parameter>y</parameter> will define the origin (or reference
     point) of the first character (roughly the lower-left corner of
     the character).  This is different from the
     <function>ImageString</function>, where <parameter>x</parameter>,
     <parameter>y</parameter> define the upper-right corner of the
     first character. Refer to PostScipt documentation about fonts and
     their measuring system if you have trouble understanding how this
     works.
    </para>
    <para>
     <parameter>Space</parameter> allows you to change the default
     value of a space in a font.  This amount is added to the normal
     value and can also be negative.
    </para>
    <para>
     <parameter>Tightness</parameter> allows you to control the amount
     of white space between characters. This amount is added to the
     normal character width and can also be negative.
    </para>
    <para>
     <parameter>Angle</parameter> is in degrees.
    </para>
    <para>
     <parameter>Antialias_steps</parameter> allows you to control the
     number of colours used for antialiasing text. Allowed values are
     4 and 16. The higher value is recommended for text sizes lower
     than 20, where the effect in text quality is quite visible.  With
     bigger sizes, use 4. It's less computationally intensive.
    </para>
    <para>
     Parameters <parameter>space</parameter> and
     <parameter>tightness</parameter> are expressed in character space
     units, where 1 unit is 1/1000th of an em-square.
    </para>
    <para>
     Parameters <parameter>space</parameter>,
     <parameter>tightness</parameter>, <parameter>angle</parameter>
     and <parameter>antialias</parameter> are optional.
    </para>
    <para>
     This function returns an array containing the following elements:
     <informaltable>
      <tgroup cols="2">
       <tbody>
	<row>
	 <entry>0</entry>
	 <entry>lower left x-coordinate</entry>
	</row>
	<row>
	 <entry>1</entry>
	 <entry>lower left y-coordinate</entry>
	</row>
	<row>
	 <entry>2</entry>
	 <entry>upper right x-coordinate</entry>
	</row>
	<row>
	 <entry>3</entry>
	 <entry>upper right y-coordinate</entry>
	</row>
       </tbody>
      </tgroup>
     </informaltable></para>
    <para>
     See also <function>imagepsbbox</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagerectangle">
   <refnamediv>
    <refname>ImageRectangle</refname>
    <refpurpose>Draw a rectangle</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imagerectangle</methodname>
      <methodparam><type>int</type><parameter>im</parameter></methodparam>
      <methodparam><type>int</type><parameter>x1</parameter></methodparam>
      <methodparam><type>int</type><parameter>y1</parameter></methodparam>
      <methodparam><type>int</type><parameter>x2</parameter></methodparam>
      <methodparam><type>int</type><parameter>y2</parameter></methodparam>
      <methodparam><type>int</type><parameter>col</parameter></methodparam>
     </methodsynopsis>
    <para>    
     <function>ImageRectangle</function> creates a rectangle of color
     col in image im starting at upper left coordinate x1, y1 and
     ending at bottom right coordinate x2, y2.  0, 0 is the top left
     corner of the image.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagesetpixel">
   <refnamediv>
    <refname>ImageSetPixel</refname>
    <refpurpose>Set a single pixel</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imagesetpixel</methodname>
      <methodparam><type>int</type><parameter>im</parameter></methodparam>
      <methodparam><type>int</type><parameter>x</parameter></methodparam>
      <methodparam><type>int</type><parameter>y</parameter></methodparam>
      <methodparam><type>int</type><parameter>col</parameter></methodparam>
     </methodsynopsis>
    <para> 
     <function>ImageSetPixel</function> draws a pixel at
     <parameter>x</parameter>, <parameter>y</parameter> (top left is
     0, 0) in image <parameter>im</parameter> of color
     <parameter>col</parameter>.
    </para> 
    <para> 
     See also <function>ImageCreate</function> and
     <function>ImageColorAllocate</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagestring">
   <refnamediv>
    <refname>ImageString</refname>
    <refpurpose>Draw a string horizontally</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imagestring</methodname>
      <methodparam><type>int</type><parameter>im</parameter></methodparam>
      <methodparam><type>int</type><parameter>font</parameter></methodparam>
      <methodparam><type>int</type><parameter>x</parameter></methodparam>
      <methodparam><type>int</type><parameter>y</parameter></methodparam>
      <methodparam><type>string</type><parameter>s</parameter></methodparam>
      <methodparam><type>int</type><parameter>col</parameter></methodparam>
     </methodsynopsis>
    <para>    
     <function>ImageString</function> draws the string
     <parameter>s</parameter> in the image identified by
     <parameter>im</parameter> at coordinates
     <parameter>x</parameter>, <parameter>y</parameter> (top left is
     0, 0) in color <parameter>col</parameter>.  If font is 1, 2, 3, 4
     or 5, a built-in font is used.  
    </para> 
    <para> 
     See also <function>ImageLoadFont</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagestringup">
   <refnamediv>
    <refname>ImageStringUp</refname>
    <refpurpose>Draw a string vertically</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imagestringup</methodname>
      <methodparam><type>int</type><parameter>im</parameter></methodparam>
      <methodparam><type>int</type><parameter>font</parameter></methodparam>
      <methodparam><type>int</type><parameter>x</parameter></methodparam>
      <methodparam><type>int</type><parameter>y</parameter></methodparam>
      <methodparam><type>string</type><parameter>s</parameter></methodparam>
      <methodparam><type>int</type><parameter>col</parameter></methodparam>
     </methodsynopsis>
    <para>    
     <function>ImageStringUp</function> draws the string
     <parameter>s</parameter> vertically in the image identified by
     <parameter>im</parameter> at coordinates
     <parameter>x</parameter>, <parameter>y</parameter> (top left is
     0, 0) in color <parameter>col</parameter>.  If font is 1, 2, 3, 4
     or 5, a built-in font is used.  
    </para> 
    <para> 
     See also <function>ImageLoadFont</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagesx">
   <refnamediv>
    <refname>ImageSX</refname>
    <refpurpose>Get image width</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imagesx</methodname>
      <methodparam><type>int</type><parameter>im</parameter></methodparam>
     </methodsynopsis>
    <para> 
     <function>ImageSX</function> returns the width of the image
     identified by <parameter>im</parameter>.
    </para>
    <para> 
     See also <function>ImageCreate</function> and
     <function>ImageSY</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagesy">
   <refnamediv>
    <refname>ImageSY</refname>
    <refpurpose>Get image height</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imagesy</methodname>
      <methodparam><type>int</type><parameter>im</parameter></methodparam>
     </methodsynopsis>
    <para>
     <function>ImageSY</function> returns the height of the image
     identified by <parameter>im</parameter>.
    </para> 
    <para>
     See also <function>ImageCreate</function> and
     <function>ImageSX</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagettfbbox">
   <refnamediv>
    <refname>ImageTTFBBox</refname>
    <refpurpose>
     Give the bounding box of a text using TypeType fonts
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>array</type><methodname>imagettfbbox</methodname>
      <methodparam><type>int</type><parameter>size</parameter></methodparam>
      <methodparam><type>int</type><parameter>angle</parameter></methodparam>
      <methodparam><type>string</type><parameter>fontfile</parameter></methodparam>
      <methodparam><type>string</type><parameter>text</parameter></methodparam>
     </methodsynopsis>
    <para>
     This function calculates and returns the bounding box in pixels
     for a TrueType text.
     <variablelist>
      <varlistentry>
       <term>
	<parameter>text</parameter>
       </term>
       <listitem>
	<simpara>The string to be measured.</simpara>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term>
	<parameter>size</parameter>
       </term>
       <listitem>
	<simpara>The font size in pixels.</simpara>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term>
	<parameter>fontfile</parameter>
       </term>
       <listitem>
	<simpara>
	 The name of the TrueType font file.  (Can also be an URL.)
	</simpara>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term>
	<parameter>angle</parameter>
       </term>
       <listitem>
	<simpara>
	 Angle in degrees in which <parameter>text</parameter> will be
	 measured.
	</simpara>
       </listitem>
      </varlistentry>
     </variablelist>
     <function>ImageTTFBBox</function> returns an array with 8
     elements representing four points making the bounding box of the
     text:
     <informaltable>
      <tgroup cols="2">
       <tbody>
	<row>
	 <entry>0</entry>
	 <entry>lower left corner, X position</entry>
	</row>
	<row>
	 <entry>1</entry>
	 <entry>lower left corner, Y position</entry>
	</row>
	<row>
	 <entry>2</entry>
	 <entry>lower right corner, X position</entry>
	</row>
	<row>
	 <entry>3</entry>
	 <entry>lower right corner, Y position</entry>
	</row>
	<row>
	 <entry>4</entry>
	 <entry>upper right corner, X position</entry>
	</row>
	<row>
	 <entry>5</entry>
	 <entry>upper right corner, Y position</entry>
	</row>
	<row>
	 <entry>6</entry>
	 <entry>upper left corner, X position</entry>
	</row>
	<row>
	 <entry>7</entry>
	 <entry>upper left corner, Y position</entry>
	</row>
       </tbody>
      </tgroup>
     </informaltable>
     The points are relative to the <emphasis>text</emphasis>
     regardless of the angle, so "upper left" means in the top
     left-hand corner seeing the text horizontallty.
    </para>
    <para>
     This function requires both the GD library and the FreeType
     library.
    </para>
    <para>
     See also <function>ImageTTFText</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagettftext">
   <refnamediv>
    <refname>ImageTTFText</refname>
    <refpurpose>
     Write text to the image using TrueType fonts
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>array</type><methodname>imagettftext</methodname>
      <methodparam><type>int</type><parameter>im</parameter></methodparam>
      <methodparam><type>int</type><parameter>size</parameter></methodparam>
      <methodparam><type>int</type><parameter>angle</parameter></methodparam>
      <methodparam><type>int</type><parameter>x</parameter></methodparam>
      <methodparam><type>int</type><parameter>y</parameter></methodparam>
      <methodparam><type>int</type><parameter>col</parameter></methodparam>
      <methodparam><type>string</type><parameter>fontfile</parameter></methodparam>
      <methodparam><type>string</type><parameter>text</parameter></methodparam>
     </methodsynopsis>
    <para>
     <function>ImageTTFText</function> draws the string
     <parameter>text</parameter> in the image identified by
     <parameter>im</parameter>, starting at coordinates
     <parameter>x</parameter>, <parameter>y</parameter> (top left is
     0, 0), at an angle of <parameter>angle</parameter> in color
     <parameter>col</parameter>, using the TrueType font file
     identified by <parameter>fontfile</parameter>.
    </para>
    <para>
     The coordinates given by <parameter>x</parameter>,
     <parameter>y</parameter> will define the basepoint of the first
     character (roughly the lower-left corner of the character).  This
     is different from the <function>ImageString</function>, where x,
     y define the upper-right corner of the first character.
    </para>
    <para>
     <parameter>Angle</parameter> is in degrees, with 0 degrees being
     left-to-right reading text (3 o'clock direction), and higher
     values representing a counter-clockwise rotation.  (i.e., a value
     of 90 would result in bottom-to-top reading text).
    </para>
    <para>
     <parameter>Fontfile</parameter> is the path to the TrueType font
     you wish to use.
    </para>
    <para>
     <parameter>Text</parameter> is the text string which may include
     UTF-8 character sequences (of the form: &amp;#123;) to access
     characters in a font beyond the first 255.
    </para>
    <para>
     <parameter>Col</parameter> is the color index.  Using the
     negative of a color index has the effect of turning off
     antialiasing.
    </para>
    <para>
     <function>ImageTTFText</function> returns an array with 8
     elements representing four points making the bounding box of the
     text.  The order of the points is upper left, upper right, lower
     right, lower left.  The points are relative to the text
     regardless of the angle, so "upper left" means in the top
     left-hand corner when you see the text horizontallty.
    </para>
    <para>
     This example script will produce a black GIF 400x30 pixels, with
     the words "Testing..."  in white in the font Arial.
     <example>
      <title>ImageTTFText</title>
      <programlisting role="php">
&lt;?php
Header ("Content-type: image/gif");
$im = imagecreate (400, 30);
$black = ImageColorAllocate ($im, 0, 0, 0);
$white = ImageColorAllocate ($im, 255, 255, 255);
ImageTTFText ($im, 20, 0, 10, 20, $white, "/path/arial.ttf", 
              "Testing... Omega: &amp;#937;");
ImageGif ($im);
ImageDestroy ($im);
?&gt;
      </programlisting>
     </example>
    </para>
    <para>
     This function requires both the GD library and the <ulink
     url="&url.freetype;">FreeType</ulink> library.
    </para>
    <para>
     See also <function>ImageTTFBBox</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagetypes">
   <refnamediv>
    <refname>ImageTypes</refname>
    <refpurpose>
     Return the image types supported by this PHP build
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>imagetypes</methodname>
      <void/>
     </methodsynopsis>
    <para>
     This function returns a bit-field corresponding to the image
     formats supported by the version of GD linked into PHP.  The
     following bits are returned, IMG_GIF | IMG_JPG | IMG_PNG |
     IMG_WBMP.  To check for PNG support, for example, do this:
     <example>
      <title>ImageTypes</title>
      <programlisting role="php">
&lt;?php
if (ImageTypes() &amp; IMG_PNG) {
    echo "PNG Support is enabled";
}
?&gt;
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.read-exif-data">
   <refnamediv>
    <refname>read_exif_data</refname>
    <refpurpose>Read the EXIF headers from a JPEG</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>array</type><methodname>read_exif_data</methodname>
      <methodparam><type>string</type><parameter>filename</parameter></methodparam>
     </methodsynopsis>
    <para>
     The <function>read_exif_data</function> function reads the
	 EXIF headers from a JPEG image file.  It returns an associative
	 array where the indexes are the Exif header names and the values
	 are the values associated with those Exif headers.  Exif headers
	 tend to be present in JPEG images generated by digital cameras, but
	 unfortunately each digital camera maker has a different idea of how
	 to actually tag their images, so you can't always rely on a specific
	 Exif header being present.
     <example>
      <title>read_exif_data</title>
      <programlisting role="php">
&lt;?php
 $exif = read_exif_data ('p0001807.jpg');
 while(list($k,$v)=each($exif)) {
   echo "$k: $v&lt;br>\n";
 }
?>

Output:
FileName: p0001807.jpg
FileDateTime: 929353056
FileSize: 378599
CameraMake: Eastman Kodak Company
CameraModel: KODAK DC265 ZOOM DIGITAL CAMERA (V01.00)
DateTime: 1999:06:14 01:37:36
Height: 1024
Width: 1536
IsColor: 1
FlashUsed: 0
FocalLength:  8.0mm
RawFocalLength: 8
ExposureTime:  0.004 s (1/250)
RawExposureTime: 0.0040000001899898
ApertureFNumber: f/ 9.5
RawApertureFNumber: 9.5100002288818
FocusDistance: 16.66m
RawFocusDistance: 16.659999847412
Orientation: 1
ExifVersion: 0200
      </programlisting>
     </example>
    </para>
    <para>
     <note>
      <simpara>
       This function is only available in PHP 4 compiled using --enable-exif
      </simpara>
      <simpara>
       This function does not require the GD image library.
      </simpara>
     </note>
    </para>
   </refsect1>
  </refentry>

 </reference>

<!-- 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:
-->