Jump to content


image help(PHP)


2 replies to this topic

#1 high6

    Young Padawan

  • Members
  • Pip
  • 57 posts

Posted 20 March 2006 - 10:35 PM

well i made this image script.(below)

Posted Image

get it so it says, "High6, funky colors man."(may need to refresh a few times). u will notice half is lines and half isnt well im running into a problem where it stops creating lines after awhile. anyone know y?

<?php


$cho = rand(0,1);
if ($cho == 0){
$l = 500;
$w = 120;

$im = imagecreate($l,$w);
$background_color = imagecolorallocate($im, 255, 255, 255);

for ($i = 0; $i < $w; $i++) {
$ran1 = rand(0,255);
$ran2 = rand(0,255);
$ran3 = rand(0,255);
$wc = ImageColorAllocate ($im, $ran1, $ran2, $ran3); 
imageline($im,0,$i,500,$i,$wc);
}
header("Content-Type: image/jpeg"); 
Imagejpeg($im,'',100); 
ImageDestroy ($im); 
}
else
{
//THIS IS THE ONE
$l = 500;
$w = 120;

$im = imagecreate($l,$w);
$background_color = imagecolorallocate($im, 255, 255, 255);

for ($i = 0; $i < $l; $i++) {
$ran1 = rand(0,255);
$ran2 = rand(0,255);
$ran3 = rand(0,255);
$wc = ImageColorAllocate ($im, $ran1, $ran2, $ran3); 
imageline($im,$i,0,$i,120,$wc);
}
$wc = ImageColorAllocate ($im, 0, 0, 0); 
imagestring($im,3,260,60,"High6, Funky colors man.",$wa);
header("Content-Type: image/jpeg"); 
Imagejpeg($im,'',100); 
ImageDestroy ($im); 
}
?>

ignore the top code thats just for creating horizontal lines.

thanks in advance, high6

Edited by high6, 20 March 2006 - 10:36 PM.


#2 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 21 March 2006 - 09:52 PM

You might want to fix your link. It would be best if you could post an actual image rather then a redirect to a dynamic image (i.e. take a screen shot of the problem image).

#3 high6

    Young Padawan

  • Members
  • Pip
  • 57 posts

Posted 22 March 2006 - 07:02 PM

View Postrc69, on Mar 21 2006, 09:52 PM, said:

You might want to fix your link. It would be best if you could post an actual image rather then a redirect to a dynamic image (i.e. take a screen shot of the problem image).

ya sry, i fixed it. i was just testing something. :)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users