Microsoft Word - Core PHP Programming Using PHP to Build Dynamic Web Sites

(singke) #1

string iptcembed(string iptc, string file, integer spool)


The iptcembed function adds IPTC blocks to JPEG files. By default the blocks are added
to the file, and the modified file is returned. The spool argument allows you to change
this behavior. If the spool flag is 1 or 2, then the modified JPEG will be sent directly to
the browser. If the spool flag is 2, the JPEG will not be returned as a string.


array iptcparse(string iptc_block)


The iptcparse function takes an IPTC block and returns an array containing all the tags
in the block. See the description of getimagesize to see how to get IPTC blocks.


Creating JPEG, PNG, and WBMP Images


All the functions in this section require the GD library. If you haven't compiled it as part
of your PHP module, either load it automatically by editing php3.ini, or use the dl
function. Some of these functions also require other libraries, which allow you to use font
files.


To get started you can use either imagecreate to start with a blank graphic, or a function
such as imagecreatefrompng to load a PNG from a file. Coordinates in these functions
treat (0, 0) to be the top-left corner and refer to pixels. Likewise, any size arguments refer
to pixels.


When creating images with these functions, you can't simply decide to output an image in
the middle of a script that outputs HTML. You must create a separate script that sends a
content-type header. All the examples illustrate this idea.


For functions that use fonts, there are five built-in fonts numbered 1, 2, 3, 4, and 5. You
may also load fonts, which will always have identifiers greater than five.


boolean imagearc(integer image, integer center_x, integer
center_y, integer width, integer height, integer start, integer
end, integer color)


Use imagearc to draw a section of an ellipse. The first argument specifies a valid image.
The ellipse is centered at center_x and center_y. The height and width are set by the
respective arguments in pixels. The start and end points of the curve are given in degrees.
Zero degrees is at 3 o'clock and proceeds counterclockwise.


<?
/*
** cut out a circular view of an image

Free download pdf