English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I am new to PHP. I want to develop a web page(site) in PHP which displays ads in client computer visiting my pages. Is it possible to display different pictures when a user visits my page without refreshing(or revisiting) my web pages?

2007-02-10 20:13:01 · 3 answers · asked by bishnu paudel 1 in Computers & Internet Programming & Design

3 answers

this would be the code:

header("Content-type: image/png");
$string = $_GET['text'];
$im = imagecreatefrompng("images/button1.png");
$orange = imagecolorallocate($im, 220, 210, 60);
$px = (imagesx($im) - 7.5 * strlen($string)) / 2;
imagestring($im, 3, $px, 9, $string, $orange);
imagepng($im);
imagedestroy($im);
?>

This example would be called from a page with a tag like: . The above button.php script then takes this "text" string and overlays it on top of a base image which in this case is "images/button1.png" and outputs the resulting image. This is a very convenient way to avoid having to draw new button images every time you want to change the text of a button. With this method they are dynamically generated.

for more infos, http://www.php.net/gd

2007-02-10 23:25:25 · answer #1 · answered by ilovephotographyandmusic 4 · 0 0

Your php code could output different img tags every time it is refreshed.

If you want something that does not require the user to load the page again you may want something dynamic on the client side like Javascript or Flash.

2007-02-10 20:19:15 · answer #2 · answered by John Mahowald 5 · 0 0

the numbers are"; for($s=0;$s<10;$s++){ echo "
".$array[$s]; } //including and dividing through 10 $sum=array_sum($array); echo "
undemanding cost is: ".$sum/10; //calculating entire type of useful numbers $p="0"; for($x=0;$x<10;$x++){ if($array[$x]>0){ $p++; } } echo "
entire type of useful numbers is/are: ".$p; ?>

2016-12-04 00:56:35 · answer #3 · answered by Anonymous · 0 0

fedest.com, questions and answers