PHP
  Home arrow PHP arrow Page 2 - Generating Images on the Fly With PHP
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Sun Developer Network 
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? 
PHP

Generating Images on the Fly With PHP
By: Divyesh Jariwala
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 56
    2001-12-13

    Table of Contents:
  • Generating Images on the Fly With PHP
  • The GD image library
  • Creating our image
  • Displaying our image
  • Generating the random number
  • Changing the font of our random number
  • Conclusion

  • 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


    Generating Images on the Fly With PHP - The GD image library


    (Page 2 of 7 )

    To generate images in real-time using PHP, we need to have the GD library installed. To make sure you have the GD library installed, create a new PHP page named checkgd.php in a directory on your web server. Enter the following code into checkgd.php:

    <?php

    phpinfo(INFO_MODULES);

    ?>


    Run the checkgd.php page on your web server. If you can find a section for the GD library (like in the sample shown below), then you have the GD library installed and ready to go:

    The details of a successfully installed GD library

    On the other hand, if you don’t see a section for the GD library, then you will need to download and install the GD library. If you are running windows, then installation instructions are available at http://php.weblogs.com/php_gd. If you are running Linux, installation instructions are available at http://www.e-gineer.com/instructions/install-gd13-for-php-with-apache-on-linux.phtml.

    Both of the links to installation instructions shown above use an older version of the GD library. This is because with the newer versions, any support for GIF images has been removed due to copyright infringements.

    As mentioned at the beginning of this article, we will be creating an image that contains a random number, similar to the methods used by yahoo.com and paypal.com when you register to become a member.

    So, now that we have the GD library installed as part of our PHP distribution, let’s jump right in and create our first image.

    More PHP Articles
    More By Divyesh Jariwala


     

    PHP ARTICLES

    - Making Usage Statistics in PHP
    - Installing PHP under Windows: Further Config...
    - File Version Management in PHP
    - Statistical View of Data in a Clustered Bar ...
    - Creating a Multi-File Upload Script in PHP
    - Executing Microsoft SQL Server Stored Proced...
    - Code 10x More Efficiently Using Data Access ...
    - A Few Tips for Speeding Up PHP Code
    - The Modular Web Page
    - Quick E-Commerce with PHP and PayPal
    - Regression Testing With JMeter
    - Building an Iterator with PHP
    - PHP Frontend to ImageMagick
    - Using PEAR's mimeDecode Module
    - Incoming Mail and PHP






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
    Stay green...Green IT