generate multiple images and display one by one in browser

images php coding issues or problems here.

Moderators: macek, egami, gesf

suhasagg
New php-forum User
New php-forum User
Posts: 1
Joined: Sat Sep 03, 2011 2:06 pm

generate multiple images and display one by one in browser

Postby suhasagg » Sat Sep 03, 2011 2:12 pm

Hi,

I want to develop application which splashes random alphabets on screen one by one with some delay.
Problem is only one image is getting displayed- how to display multiple image one by one with some delay.
My php code -
<?php

session_start();

$i =5;
while($i)

{
$img = imagecreatetruecolor(80,30);



$white = imagecolorallocate($img, 255, 255, 255);

$black = imagecolorallocate($img, 0, 0, 0);

$grey = imagecolorallocate($img,150,150,150);

$red = imagecolorallocate($img, 255, 0, 0);

$pink = imagecolorallocate($img, 200, 0, 150);





for($i=1;$i<=rand(1,5);$i++){

$color = (rand(1,2) == 1) ? $pink : $red;

imageline($img,rand(5,70),rand(5,20), rand(5,70)+5,rand(5,20)+5, $color);

}



imagefill($img, 0, 0, $white);


$l=rand(97,122);
$string = chr($l);



$_SESSION['string'] = $string;



imagettftext($img, 11, 0, rand(5,60), rand(5,25), $black, "calibri.ttf", $string);


header("Content-type: image/png");

imagepng($img);

imagedestroy($img);

$i--;

}
?>

Return to “PHP coding => Images”

Who is online

Users browsing this forum: No registered users and 1 guest