Miscellaneous
  Home arrow Miscellaneous arrow Page 2 - An Intro to Using the GD Image Library...
Codewalker Forums 
  Tutorials  
Database Articles  
Miscellaneous  
Navigation Usability  
PEAR Articles  
Programming Basics  
Server Administration  
XML Tutorials  
  Reviews  
Database Book Reviews  
Linux Book Reviews  
Miscellaneous Reviews  
PHP Book Reviews  
PHP Software Reviews  
Server Admin Reviews  
SQL Tool Reviews  
  Code Gallery  
Content Management Code  
Contest Code  
Counters Code  
Database Code  
Date Time Code  
Discussion Board Code  
Email Code  
File Manipulation Code  
GUI Code  
Link Farm Code  
Miscellaneous Code  
Search Code  
Site Navigation Code  
User Management Code  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Download TestComplete 
Forums Sitemap 
Weekly Newsletter 
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
MISCELLANEOUS

An Intro to Using the GD Image Library with PHP
By: Matt Wade
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 4
    2002-01-25

    Table of Contents:
  • An Intro to Using the GD Image Library with PHP
  • Getting to Know the Functions
  • More Functions
  • And Even More Functions
  • Putting It All Together
  • Let's Finish It Up

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    An Intro to Using the GD Image Library with PHP - Getting to Know the Functions


    (Page 2 of 6 )

    OK, let's take a look at some of the functions we will be using in order to create the clock.

    int ImageCreate(int x_size, int y_size)

    This one is simple enough; all we need to do is pass this function two integers that represent the width and height of the image we are creating. This function returns an identifier to our blank image. Worth noting is that the upper left corner of an image is the coordinate 0,0. That means if you create an image with a width of 100, the x coordinates will run from 0 through 99.

    int ImageDestroy (int im)

    With ImageDestroy, we can get rid of the images we create with ImageCreate.

    int ImageColorAllocate(int im, int red, int green, int blue)

    The first parameter to this function is the image identifier that we will have assigned by the ImageCreate function. Remember good old RGB colors? I hope so, you need to use them here. The next three parameters are the values for red, green and blue respectively. Some common colors are (0,0,0) for black, (255,255,255) for white and (255,0,0) for red. Here's a link to a good RGB chart that I found. If for some reason the function fails to allocate the color, it will return a value of -1.

    int ImageFilledRectangle (int im, int x1, int y1, int x2, int y2, int col)

    This function is used to create a simple filled rectangle or square. All you do is pass it the image you are working with, upper left x-y coordinates, the lower right x-y coordinates and a color that you created with ImageColorAllocate. Remember that images start at 0,0!

    More Miscellaneous Articles
    More By Matt Wade


       · I've created a function that resizes an image and displays it in the browser or at...
       · Have you tried sending headers from the script anyway? If it's a separate script...
     

    MISCELLANEOUS ARTICLES

    - Using PHP to Stream MP3 Files and Prevent Il...
    - 10 Must Have Firefox Improvements
    - All About OpenOffice 3.0
    - Shell Script Writing
    - Loops in the UNIX Shell
    - The Test in the UNIX Shell
    - Data Streams and the UNIX Shell
    - Control Mechanisms of the UNIX Shell
    - Variables Within the UNIX Shell
    - The Shell and UNIX
    - In Detail: UNIX File Systems
    - Rights Management in UNIX
    - UNIX File Systems
    - The Terminal in UNIX
    - Operating Systems and UNIX





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    Stay green...Green IT