Page 287 - Open Soource Technologies 304.indd
P. 287

Unit 11: Graphics



                 as create charts on the fly, create an anti-robot security image, create thumbnail images,   Notes
                 or even build images from other images.
               •  GD  has  an  existing  API,  and  PHP  tries  to  follows  its  syntax  and  function-naming
                 conventions. So, if you are familiar with GD from other languages, such as C or Perl, you
                 can easily use GD with PHP.
               •  PHP cleans up the image when the script ends, but, if you wish to manually deallocate
                 the memory used by the image, calling ImageDestroy($image)forces PHP to get rid of
                 the image immediately.

               •  The standard rectangular or Cartesian (named after René Descartes) has two perpendicular
                 real number lines (axes) which divide the plane into four quadrants. The place where the
                 number lines cross is the origin (0, 0) and the numbering is positive to the right and up;
                 negative to the left and down.
               •  One of the most basic features of computers today is the ability to edit graphics. Many
                 times, you need to build web applications that take image data from users and scale it
                 down to a format that can easily be displayed on your website.
               •  Colour support improved markedly between GD 1.x and GD 2.x. In GD 1.x there was no
                 notion of the alpha channel, colour handling was rather simple, and the library supported
                 only 8-bit palette images (256 colours).

               •  An interesting use of the ImageColorAt( ) function is to loop through each pixel in an
                 image and check the colour, and then do something with that colour data.


            11.10 Keywords

            .bmp: (pronounced “bimp”) this is a “bitmap.” You will probably never place a bitmap as an
            image, although some browsers do allow it. A bitmap is an image that a computer produces
            and places for you. For example counter.
            .jpeg or .jpg: (pronounced “j-peg”) there are two names to denote this format because of the PC
            and MAC formats allowing 3 and 4 letters after the dot. JPEG is an acronym for Joint Photographic
            Experts Group, the organization that invented the format.

            .png: Pronounced as ‘ping’, this stands for Portable Network Graphic. This is ultimately the
            replacement for .gif, with partial transparency options, but browser support is sketchy—some
            browsers still do not like to display .png files.
            Alpha blending: Alpha blending is a toggle that determines whether the alpha channel, if present,
            should be applied when drawing. If alpha blending is off, the old pixel is replaced with the new
            pixel. If an alpha channel exists for the new pixel, it is maintained, but all pixel information for
            the original pixel being overwritten is lost.
            ALT: It stands for “alternate text”. This tells the browser that if it cannot find the image, then
            just displays this text. It also tells anyone who cannot view your image what the image is about.
            Antialiasing: Antialiasing is where pixels at the edge of a shape are moved or recoloured to
            make a gradual transition between the shape and its background. This prevents the rough and
            jagged edges that can make for unappealing images.

            Gif: This is pronounced “jif” or “gif” (hard “G”) depending on whom you speak to.  “jif”, like
            the peanut butter. This is an acronym for Graphics Interchange Format.
            HEIGHT: It stands for, as you might guess, the height of the image in pixels. Again, the height
            can be just about anything, but generally will be less than the height of the web browser.



                                             LOVELY PROFESSIONAL UNIVERSITY                                   281
   282   283   284   285   286   287   288   289   290   291   292