HTML
  Home arrow HTML arrow Page 5 - Submitting a Form Using an Image Tag
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? 
HTML

Submitting a Form Using an Image Tag
By: Chris Root
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 18
    2005-04-18

    Table of Contents:
  • Submitting a Form Using an Image Tag
  • Submitting a Form
  • Processing the Form
  • The Server Side Code
  • GD Methods
  • Handling the Name
  • The TextBox Class
  • From the Top

  • 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


    Submitting a Form Using an Image Tag - GD Methods


    (Page 5 of 8 )

    In order to load an existing image for use by our application, we'll need to use the imagecreatefrompng() function. You can also use other image formats, provided you have the proper support libraries. This function accepts a single argument that is the path to an image as a string. It returns a resource handle to the image that you can then use to work with the image.

    If you are going to draw anything with GD, including text, you will need to allocate a color to be used. The imagecolorallocate() function does just that. This function takes as its first argument the resource handle that was created with one of the image creation functions. The remaining three arguments are hexadecimal or numerical RGB values. For instance, allocating a blue color would look like the following:

    $bluecolor = imagecolorallocate($resource,0,0,255);

    If you choose, as I did in the example, to use the numerical values to define a color, the numbers must be between 0 and 255. The first value is red, the second green and the third blue. Mixing these three colors will give you any color you might need within the limits of an 8 bit pallet.

    In GD you can use true type, postscript or freetype fonts. Your distribution may not have support for all of these. Check your php.ini configuration and the PHP documentation for details.

    Whatever font system you use, I would suggest using your own fonts rather than any that are built in. In order to to do this you will need to make some fonts available for use by PHP. Rather than give PHP permission to your fonts directory, make a directory in your Web structure for fonts you might want to use with GD that has the proper permissions assigned to it.

    In this example we'll be using True Type fonts. The function for creating text used in this project is imagettftext(). This function takes a whopping eight arguments for this example. The first is the image resource, then the font size as an integer, an angle parameter that allows the text to be drawn at an angle and a horizontal and vertical coordinate as integers. These are followed by the path to the font as a string and the string to print.

    In order to center anything, we will need to determine some coordinates. Doing this with the image we just loaded is easy. Using imagesx() (width) and imagesy() (height), we can get the dimensions of the created image. Determining the size of a text block is a little more difficult.

    More HTML Articles
    More By Chris Root


       · That needs JavaScript to submit a form?At least have a server side validation and...
       · I specifically left validation up to the reader as validation is a topic all by...
       · Accessibility means that you make sure anyone can use the application regardless of...
       · I did not mean to imply that I ignore accessibility in my real projects. I always...
       · I've been using a hidden IFrame to handle form submissions - the web page shunts all...
       · For 'Anonymous Loozah #1'there are many ways to submit forms on the web... some...
     

    HTML ARTICLES

    - Using a 3D HTML Table as a Recordset
    - Building a 3D HTML Table
    - Maximizing and Restoring HTML Images: Layer ...
    - Completing Construction of a Database Form w...
    - Maximizing and Restoring Images in a Tabular...
    - Building the Recordset for an HTML Database ...
    - Laying Out a Database Form with HTML
    - Tabular Database Form Functions with HTML
    - Tabular Database Forms with HTML
    - Using the Find Functions for HTML Database F...
    - Sorting for Database Forms with HTML
    - Edit and Other Database Form Functions with ...
    - More Database Form Functions with HTML
    - Database Form Functions with HTML
    - Using the HTML Table Element as a Recordset






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