|
||||||
| PHP Tutorials PHP Tutorials |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||||
|
Introduction: Have you ever been on aim and received a message from one of your friends with a big long URL followed by something like "John%20Is%20Stupid." You know what ever it is, wont be worth your time, but you click on it anyway to find someone goofy looking holding a sign and on it printed in big bold letters “John Is Stupid.” Ever wonder how they work? Chances are the script takes advantage of the GD functions. In this tutorial you will learn many GD functions that you can use to generate images. The goal for this tutorial is for you to generate a dynamic user bar. Here is a list of the functions used in this tutorial: header() imagecolorallocate() imagettfbbox() imagesx() abs() imagettftext() imagepng() imagedestroy() Solution: The first thing you want to do is create the header type using the header function. Next you use the GD tools to create an image from a png file. In my case, I have userbar.png in the same directory as this script is in. The function imagecolorallocate creates a color using RGB (red-green-blue) format. The next three lines just set some basic information which isn’t that hard to understand. The last three lines to must of the work creating the image. The most important function here to pay attention to is imagettftext. The imagettftext requires 8 arguments which are the resource image, font size, the angle, x location, y location, font color, the actual font, and the string to be printed. PHP Code:
PHP Code:
PHP Code:
PHP Code:
PHP Code:
Code:
<img src="http://www.yourdomain.com/generator.php?text=JUNKIE" /> Last edited by John; 11-02-2008 at 12:13 AM.. |
|
|||||
|
Nice Tutorial, very well done.
__________________
CodeCall Blog | CodeCall Wiki | Shareware Site | Linux Forum | Write a Blog Post a job on our freelance section! Paste between computers/devices and Collaborate on Code!. |
|
|||||
|
I have a problem with the 1st tutorial.. I made this:- Code:
<html> <img src="http://localhost/generator.php?text=ADMINISTRATOR" /> </html> I even tried to upload it to a hosting site that supports php.. still broken link... Last edited by TcM; 12-04-2006 at 11:54 PM.. |
|
|||||
|
I'm betting you do not have GD working or compiled into your system. Is it a Windows System? Create a PHP file named phpinfo.php and put this in it: PHP Code:
__________________
CodeCall Blog | CodeCall Wiki | Shareware Site | Linux Forum | Write a Blog Post a job on our freelance section! Paste between computers/devices and Collaborate on Code!. |
|
|||||
|
Well when I tried localhost/phpinfo.php nothing cameup.. perhaps its not configured correctly but then I tried it on a hosting site yes it is Enabled!!:- Quote:
Quote:
Last edited by TcM; 12-04-2006 at 02:04 PM.. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| PHP:Tutorial - Email Verification | John | PHP Tutorials | 3 | 09-19-2007 12:19 PM |
| PHP:Tutorial The Date | John | PHP Tutorials | 0 | 01-10-2007 06:10 PM |
Algorithms and Data Structures
Programming Language Popularity
Code Collaboration
Podnet IRC Network
AmpHosted
Goal #1: 1,000 Blogs
Goal #2: 1,000 Wiki Pages
Goal #3: 300,000 Posts
Goal #4: 20,000 Threads
Done: 30%, 23%, 55%, 75%