Copyright © 2005-2008 Andrea Tincani

AndreaPHP | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (RSS mod for tForum)Next Topic (Welcome to my new Site) New Topic New Poll Post Reply
AndreaPHP Forum : PHP General : Dynamic image
Poster Message
usdrunk
Level: Protégé

Registered: 20-03-2006
Posts: 6

icon Dynamic image

Hi,
I wonder how people can make the dynamic image, like Alexa ranking button, or dynamic sign (have IP address, browser infomation...) How can they do that?

I don't know exactly where I can post this thing, so I post here.

Thankx

26-03-2006 at 12:28 AM
View Profile Send Email to User Show All Posts | Quote Reply
admin
Level: Administrator


Registered: 04-04-2002
Posts: 35

icon Re: Dynamic image

PHP creates dynamic images by using the GD library, first you have to check your PHP installation if it includes GD then you may want to take a look at this:

http://www.boutell.com/gd/

by using GD special functions it is possible to create PHP scripts that return images instead of HTML content

____________________________
AndreaVB

31-03-2006 at 06:26 AM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
admin
Level: Administrator


Registered: 04-04-2002
Posts: 35

icon Re: Dynamic image

this is a little script I use to generate a random number inside a picture to validate user regitration:


<?php 
 
/*Send header*/ 
Header("Content-Type: image/png"); 

/* initialize a session. */ 
session_start(); 

/*We'll set this variable later.*/ 
$new_string

/*register the session variable. */ 
session_register('new_string'); 

/* set up image*/ 
/*The first number is the width and the second is the height*/ 
$im ImageCreate(20040);   

/*creates two variable to store color*/ 
$white ImageColorAllocate($im255255255); 
$black ImageColorAllocate($im000); 

/*random string generator.*/ 
/*The seed for the random number*/ 
srand((double)microtime()*1000000);  

/*Runs the string through the md5 function--which is a function
that encrypts a string, changing it into a 32 character string
composed of numbers and lowercase letters*/ 

$string md5(rand(0,9999));  

/*Creates the new string. The first number is the point in the 32 
character string where we will pull our string from. In other 
words, PHP will count (beginning at 0) 17 characters into the 
string. The 18th character in will be our beginning point 
(remember, PHP starts counting from 0). From there, PHP 
counts 5 characters from that point, and thus, we get our five 
character string. The second number is the length of our 
string--changing this number will give us different string 
lengths.*/ 
$new_string substr($string175);  

 
/*fill image with black*/ 
ImageFill($im00$black); 

 
/*write string at coordinates (70,10) in the color white. (70, 10)
 puts the string almost in the middle of the image.*/ 
ImageString($im47010$new_string$white); 

 
/*output to browser*/ 
ImagePNG($im); 
ImageDestroy($im);  
?> 



then save this as verify.php
by adding in your html the reference to this you'll se a random number inside an image

<img src="verify.php">

[Edited by admin on 31-03-2006 at 07:30 AM GMT]

____________________________
AndreaVB

31-03-2006 at 06:29 AM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
BeeGirl033
Level: Trainee

Registered: 06-04-2007
Posts: 3

icon licenses change

Does anyone with more knowledge know anything on how to do this?

Thanks guys.

Ec2Link Website Hosting of E-Commerce Forum!

06-04-2007 at 11:50 AM
View Profile Send Email to User Show All Posts | Quote Reply
JLRodgers
Level: Moderator

Registered: 04-04-2002
Posts: 16

icon Re: Dynamic image

What do you mean more knowledge?  That's the answer of how to do it, how it's done, with an example!

____________________________
Everywhere's Local (pre-release), My company's website

07-04-2007 at 04:54 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
AndreaPHP Forum : PHP General : Dynamic image
Previous Topic (RSS mod for tForum)Next Topic (Welcome to my new Site) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: AndreaVB

Copyright © 2005-2008 Andrea Tincani

Powered by: tForum tForum Edition b0.92p1
Originally created by Toan Huynh (Copyright © 2000)
Enhanced by the tForumHacks team.