File: image.sgml

package info (click to toggle)
php3 1%3A3.0.5-3
  • links: PTS
  • area: main
  • in suites: slink
  • size: 8,348 kB
  • ctags: 9,086
  • sloc: ansic: 76,362; sh: 2,333; php: 1,329; yacc: 1,148; makefile: 970; perl: 763; cpp: 529; awk: 90; sql: 11
file content (1033 lines) | stat: -rw-r--r-- 36,924 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

 <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
    JPEG, GIF, and PNG images, and if you have the GD library
    (available at http://www.boutell.com/gd/) you will also be
    able to create and manipulate GIF images.
  </partintro>

  <refentry id="function.getimagesize">
   <refnamediv>
    <refname>GetImageSize</refname>
    <refpurpose>get the size of a GIF, JPG or PNG image</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcdef>array <function>getimagesize</function></funcdef>
     <paramdef>string <parameter>filename</parameter></paramdef>
    </funcsynopsis>
    <para>
     The <function>GetImageSize</function> function will determine the
     size of any <acronym>GIF</acronym>, <acronym>JPG</acronym> or
     <acronym>PNG</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>
     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.
     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>
&lt;?php $size = GetImageSize("img/flag.jpg"); ?>
&lt;IMG SRC="img/flag.jpg" &lt;?php echo $size[3]; ?>>
</programlisting></example>

     <note><simpara>
       This function does not require the GD image library.
      </simpara></note>

   </refsect1>
  </refentry>

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

   </refsect1>
  </refentry>

  <refentry id="function.imagechar">
   <refnamediv>
    <refname>ImageChar</refname>
    <refpurpose>draw a character horizontally</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcdef>int <function>imagechar</function></funcdef>
     <paramdef>int <parameter>im</parameter></paramdef>
     <paramdef>int <parameter>font</parameter></paramdef>
     <paramdef>int <parameter>x</parameter></paramdef>
     <paramdef>int <parameter>y</parameter></paramdef>
     <paramdef>string <parameter>c</parameter></paramdef>
     <paramdef>int <parameter>col</parameter></paramdef>
    </funcsynopsis>
    <para>
     ImageChar draws the first character of c in the image identified
     by id at coordinates x, y (top left is 0,0) with the color col.
     If font is 1, 2, 3, 4 or 5, a built-in font is used.

    <para>
     See also <function>imageloadfont</function>.

   </refsect1>
  </refentry>

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

  <refentry id="function.imagecolorallocate">
   <refnamediv>
    <refname>ImageColorAllocate</refname>
    <refpurpose>allocate a color for an image</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcdef>int <function>imagecolorallocate</function></funcdef>
     <paramdef>int <parameter>im</parameter></paramdef>
     <paramdef>int <parameter>red</parameter></paramdef>
     <paramdef>int <parameter>green</parameter></paramdef>
     <paramdef>int <parameter>blue</parameter></paramdef>
    </funcsynopsis>
<para>    ImageColorAllocate returns a color identifier representing the
    color composed of the given RGB components.  The im
    argument is the return from the <function>imagecreate</function>
    function.  ImageColorAllocate must be called to create each color
    that is to be used in the image represented by im.
   </refsect1>
  </refentry>

  <refentry id="function.imagecolortransparent">
   <refnamediv>
    <refname>ImageColorTransparent</refname>
    <refpurpose>define a color as transparent</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcdef>int <function>imagecolortransparent</function></funcdef>
     <paramdef>int <parameter>im</parameter></paramdef>
     <paramdef>int <parameter>col</parameter></paramdef>
    </funcsynopsis>
<para>    ImageColorTransparent sets the transparent color in the im image
    to col.  im is the image identifier returned by <function>imagecreate</function>
    and col is the color identifier returned by
    <function>imagecolorallocate</function>.
   </refsect1>
  </refentry>

  <refentry id="function.imagecopyresized">
   <refnamediv>
    <refname>ImageCopyResized</refname>
    <refpurpose>copy and resize part of an image</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcdef>int <function>imagecopyresized</function></funcdef>
     <paramdef>int <parameter>dst_im</parameter></paramdef>
     <paramdef>int <parameter>src_im</parameter></paramdef>
     <paramdef>int <parameter>dstX</parameter></paramdef>
     <paramdef>int <parameter>dstY</parameter></paramdef>
     <paramdef>int <parameter>srcX</parameter></paramdef>
     <paramdef>int <parameter>srcY</parameter></paramdef>
     <paramdef>int <parameter>dstW</parameter></paramdef>
     <paramdef>int <parameter>dstH</parameter></paramdef>
     <paramdef>int <parameter>srcW</parameter></paramdef>
     <paramdef>int <parameter>srcH</parameter></paramdef>
    </funcsynopsis>
    <para>
     ImageCopyResized 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.
   </refsect1>
  </refentry>

  <refentry id="function.imagecreate">
   <refnamediv>
    <refname>ImageCreate</refname>
    <refpurpose>create a new image</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcdef>int <function>imagecreate</function></funcdef>
     <paramdef>int <parameter>x_size</parameter></paramdef>
     <paramdef>int <parameter>y_size</parameter></paramdef>
    </funcsynopsis>
<para>    ImageCreate returns an image identifier representing a blank image
    of size x_size by y_size.
   </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>
    <funcsynopsis>
     <funcdef>int <function>imagecreatefromgif</function></funcdef>
     <paramdef>string <parameter>filename</parameter></paramdef>
    </funcsynopsis>
<para>    ImageCreateFromGif returns an image identifier representing the
    image obtained from the given filename.
   </refsect1>
  </refentry>

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

  <refentry id="function.imagedestroy">
   <refnamediv>
    <refname>ImageDestroy</refname>
    <refpurpose>destroy an image</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcdef>int <function>imagedestroy</function></funcdef>
     <paramdef>int <parameter>im</parameter></paramdef>
    </funcsynopsis>
<para>    ImageDestroy frees any memory associated with image im.  im is the
    image identifier returned by the <function>imagecreate</function>
    function.
   </refsect1>
  </refentry>

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

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

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

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

  <refentry id="function.imagefontheight">
   <refnamediv>
    <refname>ImageFontHeight</refname>
    <refpurpose>get font height</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcdef>int <function>imagefontheight</function></funcdef>
     <paramdef>int <parameter>font</parameter></paramdef>
    </funcsynopsis>
<para>    Returns the pixel width of a character in font.
  <para>    See also <function>imagefontwidth</function> and <function>imageloadfont</function>.
   </refsect1>
  </refentry>

  <refentry id="function.imagefontwidth">
   <refnamediv>
    <refname>ImageFontWidth</refname>
    <refpurpose>get font width</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcdef>int <function>imagefontwidth</function></funcdef>
     <paramdef>int <parameter>font</parameter></paramdef>
    </funcsynopsis>
<para>    Returns the pixel width of a character in font.
  <para>    See also <function>imagefontheight</function> and <function>imageloadfont</function>.
   </refsect1>
  </refentry>

  <refentry id="function.imagegif">
   <refnamediv>
    <refname>ImageGif</refname>
    <refpurpose>output image to browser or file</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcdef>int <function>imagegif</function></funcdef>
     <paramdef>int <parameter>im</parameter></paramdef>
     <paramdef>string <parameter>filename</parameter></paramdef>
    </funcsynopsis>
<para>    ImageGif creates the GIF file in filename from the image im.  The im argument is the return from the
    <function>imagecreate</function> function.
  <para>    The image format will be GIF87a unless the image has
    been made transparent with <function>imagecolortransparent</function>, in
    which case the image format will be GIF89a.
  <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 the

    header

    function, you can create a PHP script that outputs GIF images
    directly.
   </refsect1>
  </refentry>

  <refentry id="function.imageinterlace">
   <refnamediv>
    <refname>ImageInterlace</refname>
    <refpurpose>enable or disable interlace</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcdef>int <function>imageinterlace</function></funcdef>
     <paramdef>int <parameter>im</parameter></paramdef>
     <paramdef>int <parameter>interlace</parameter></paramdef>
    </funcsynopsis>
<para>    ImageInterlace 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.
   </refsect1>
  </refentry>

  <refentry id="function.imageline">
   <refnamediv>
    <refname>ImageLine</refname>
    <refpurpose>draw a line</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcdef>int <function>imageline</function></funcdef>
     <paramdef>int <parameter>im</parameter></paramdef>
     <paramdef>int <parameter>x1</parameter></paramdef>
     <paramdef>int <parameter>y1</parameter></paramdef>
     <paramdef>int <parameter>x2</parameter></paramdef>
     <paramdef>int <parameter>y2</parameter></paramdef>
     <paramdef>int <parameter>col</parameter></paramdef>
    </funcsynopsis>
<para>    ImageLine draws a line from x1,y1 to
    x2,y2 (top left is
    0,0) in image im of color
    col.
  <para>    See also <function>imagecreate</function> and <function>imagecolorallocate</function>.
   </refsect1>
  </refentry>

  <refentry id="function.imageloadfont">
   <refnamediv>
    <refname>ImageLoadFont</refname>
    <refpurpose>load a new font</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcdef>int <function>imageloadfont</function></funcdef>
     <paramdef>string <parameter>file</parameter></paramdef>
    </funcsynopsis>
    <para>
     ImageLoadFont 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>
     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>
     <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>
     See also <function>ImageFontWidth</function> and
     <function>ImageFontHeight</function>.

   </refsect1>
  </refentry>

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

  <refentry id="function.imagerectangle">
   <refnamediv>
    <refname>ImageRectangle</refname>
    <refpurpose>draw a rectangle</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcdef>int <function>imagerectangle</function></funcdef>
     <paramdef>int <parameter>im</parameter></paramdef>
     <paramdef>int <parameter>x1</parameter></paramdef>
     <paramdef>int <parameter>y1</parameter></paramdef>
     <paramdef>int <parameter>x2</parameter></paramdef>
     <paramdef>int <parameter>y2</parameter></paramdef>
     <paramdef>int <parameter>col</parameter></paramdef>
    </funcsynopsis>
<para>    ImageRectangle 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.
   </refsect1>
  </refentry>

  <refentry id="function.imagesetpixel">
   <refnamediv>
    <refname>ImageSetPixel</refname>
    <refpurpose>set a single pixel</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcdef>int <function>imagesetpixel</function></funcdef>
     <paramdef>int <parameter>im</parameter></paramdef>
     <paramdef>int <parameter>x</parameter></paramdef>
     <paramdef>int <parameter>y</parameter></paramdef>
     <paramdef>int <parameter>col</parameter></paramdef>
    </funcsynopsis>
<para>    ImageSetPixel draws a pixel at x,y
    (top left is 0,0) in image im
    of color col.
  <para>    See also <function>imagecreate</function> and <function>imagecolorallocate</function>.
   </refsect1>
  </refentry>

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

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

  <refentry id="function.imagesx">
   <refnamediv>
    <refname>ImageSX</refname>
    <refpurpose>get image width</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcdef>int <function>imagesx</function></funcdef>
     <paramdef>int <parameter>im</parameter></paramdef>
    </funcsynopsis>
<para>    ImageSX returns the width of the image identified by
    im.
  <para>    See also <function>imagecreate</function> and <function>imagesy</function>.
   </refsect1>
  </refentry>

  <refentry id="function.imagesy">
   <refnamediv>
    <refname>ImageSY</refname>
    <refpurpose>get image height</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcdef>int <function>imagesy</function></funcdef>
     <paramdef>int <parameter>im</parameter></paramdef>
    </funcsynopsis>
    <para>
     ImageSY returns the height of the image identified by im.
    <para>See also <function>imagecreate</function> and
    <function>imagesx</function>.
   </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>
    <funcsynopsis>
     <funcdef>array <function>ImageTTFBBox</function></funcdef>
     <paramdef>int <parameter>size</parameter></paramdef>
     <paramdef>int <parameter>angle</parameter></paramdef>
     <paramdef>string <parameter>fontfile</parameter></paramdef>
     <paramdef>string <parameter>text</parameter></paramdef>
    </funcsynopsis>
    <para>
     This function calculates and returns the bounding box in pixels
     a TrueType text.
     <variablelist>
      <varlistentry>
       <term><parameter>text</parameter></term>
       <listitem><simpara>The string to be measured.
      </varlistentry>
      <varlistentry>
       <term><parameter>size</parameter></term>
       <listitem><simpara>The font size.
      </varlistentry>
      <varlistentry>
       <term><parameter>fontfile</parameter></term>
       <listitem><simpara>The name of the TrueType font file.  (Can
	 also be an URL.)
      </varlistentry>
      <varlistentry>
       <term><parameter>angle</parameter></term>
       <listitem><simpara>Angle in degrees in which
	 <parameter>text</parameter> will be measured.
      </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>
     This function requires both the GD library and the Freetype library.
    <para>
     See also <function>ImageTTFText</function>.
   </refsect1>
  </refentry>

  <refentry id="function.imagettftext">
   <refnamediv>
    <refname>ImageTTFText</refname>
    <refpurpose>write text to the image using a TrueType fonts</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcdef>array <function>ImageTTFText</function></funcdef>
     <paramdef>int <parameter>im</parameter></paramdef>
     <paramdef>int <parameter>size</parameter></paramdef>
     <paramdef>int <parameter>angle</parameter></paramdef>
     <paramdef>int <parameter>x</parameter></paramdef>
     <paramdef>int <parameter>y</parameter></paramdef>
     <paramdef>int <parameter>col</parameter></paramdef>
     <paramdef>string <parameter>fontfile</parameter></paramdef>
     <paramdef>string <parameter>text</parameter></paramdef>
    </funcsynopsis>
    <para>
     ImageTTFText draws the string <parameter>text</parameter> in the
     image identified by <parameter>im</parameter>, starting at
     coordinates <parameter>x,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>
     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>
     <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>
     <parameter>fontfile</parameter> is the path to the TrueType font
     you wish to use.
    <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>
     <parameter>col</parameter> is the color index.  Using the negative
	 of a color index has the effect of turning off antialiasing.
    <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>
     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>
&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>
     This function requires both the GD library and the Freetype library.
    <para>
     See also <function>ImageTTFBBox</function>.
   </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>
    <funcsynopsis>
     <funcdef>int <function>imagecolorat</function></funcdef>
     <paramdef>int <parameter>im</parameter></paramdef>
     <paramdef>int <parameter>x</parameter></paramdef>
     <paramdef>int <parameter>y</parameter></paramdef>
    </funcsynopsis>
    <para>
     Returns the index of the color of the pixel at the
     specified location in the image.
    <para>
     See also <function>imagecolorset</function> and
     <function>imagecolorsforindex</function>.
   </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>
    <funcsynopsis>
     <funcdef>int <function>imagecolorclosest</function></funcdef>
     <paramdef>int <parameter>im</parameter></paramdef>
     <paramdef>int <parameter>red</parameter></paramdef>
     <paramdef>int <parameter>green</parameter></paramdef>
     <paramdef>int <parameter>blue</parameter></paramdef>
    </funcsynopsis>
    <para>
     Returns the index of the color in the palette of the image
     which is "closest" to the specified RGB value.
    <para>
     The "distance" between the desired color and each color in the palette is
     calculated as if the RGB values represented points in three-dimensional
     space.
    <para>
     See also <function>imagecolorexact</function>.
   </refsect1>
  </refentry>

  <refentry id="function.imagecolorexact">
   <refnamediv>
    <refname>ImageColorExact</refname>
    <refpurpose>get the index of the specified color</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcdef>int <function>imagecolorexact</function></funcdef>
     <paramdef>int <parameter>im</parameter></paramdef>
     <paramdef>int <parameter>red</parameter></paramdef>
     <paramdef>int <parameter>green</parameter></paramdef>
     <paramdef>int <parameter>blue</parameter></paramdef>
    </funcsynopsis>
    <para>
     Returns the index of the specified color in the palette of the image.
    <para>
     If the color does not exist in the image's palette, -1 is returned.
    <para>
     See also <function>imagecolorclosest</function>.
   </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>
    <funcsynopsis>
     <funcdef>int <function>imagecolorresolve</function></funcdef>
     <paramdef>int <parameter>im</parameter></paramdef>
     <paramdef>int <parameter>red</parameter></paramdef>
     <paramdef>int <parameter>green</parameter></paramdef>
     <paramdef>int <parameter>blue</parameter></paramdef>
    </funcsynopsis>
    <para>
     This function is guaranteed to return a color index for a requested color, either the exact color
	 or the closest possible alternative.  
    <para>
     See also <function>imagecolorclosest</function>.
   </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>
    <funcsynopsis>
     <funcdef>bool <function>imagecolorset</function></funcdef>
     <paramdef>int <parameter>im</parameter></paramdef>
     <paramdef>int <parameter>index</parameter></paramdef>
     <paramdef>int <parameter>red</parameter></paramdef>
     <paramdef>int <parameter>green</parameter></paramdef>
     <paramdef>int <parameter>blue</parameter></paramdef>
    </funcsynopsis>
    <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>
     See also <function>imagecolorat</function>.
   </refsect1>
  </refentry>

  <refentry id="function.imagecolorsforindex">
   <refnamediv>
    <refname>ImageColorsForIndex</refname>
    <refpurpose>get the colors for an index</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcdef>array <function>imagecolorsforindex</function></funcdef>
     <paramdef>int <parameter>im</parameter></paramdef>
     <paramdef>int <parameter>index</parameter></paramdef>
    </funcsynopsis>
    <para>
     This returns an associative array with red, green, and blue keys
     that contain the appropriate values for the specified color index.
    <para>
     See also <function>imagecolorat</function> and
     <function>imagecolorexact</function>.
   </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>
    <funcsynopsis>
     <funcdef>int <function>imagecolorstotal</function></funcdef>
     <paramdef>int <parameter>im</parameter></paramdef>
    </funcsynopsis>
    <para>
     This returns the number of colors in the specified image's palette.
    <para>
     See also <function>imagecolorat</function> and
     <function>imagecolorsforindex</function>.
   </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
sgml-parent-document:nil
sgml-default-dtd-file:"../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->