almightyegg Posted September 14, 2007 Share Posted September 14, 2007 <?php header("Content-type: image/png"); $w = 300; $h = 200; $im = ImageCreate($w, $h); $white = ImageColorAllocate($im, 255,255,255); $black = ImageColorAllocate($im, 0, 0, 0); $red = ImageColorAllocate($im, 255, 50, 50); $green = ImageColorAllocate($im, 30, 100, 30); $blue = ImageColorAllocate($im, 50, 50, 255); // DRAW BACKGROUND ImageFilledRectangle($im, 0, 0, $w, $h, $black); ImageFilledRectangle($im, 0, 0, 10, 10, $green); ImageFilledRectangle($im, 0, 10, 10, 10, $green); ImageFilledRectangle($im, 0, 20, 10, 10, $green); ImageFilledRectangle($im, 0, 30, 10, 10, $green); # Output the image to the browser ImagePng($im); ?> It only prints 1 green rectangle, the first one....the others are meant to be directly below each other...why aren't they showing??? Link to comment https://forums.phpfreaks.com/topic/69386-problems-repeating-image-in-gd/ Share on other sites More sharing options...
phat_hip_prog Posted September 14, 2007 Share Posted September 14, 2007 Wierd, yes it seems to go (w, h, x, y)... I didn't think it did (x, y, w, h) is normal! <?php header("Content-type: image/jpeg"); $w = 300; $h = 200; //$im = ImageCreate($w, $h); $im = imagecreatetruecolor($w, $h); $white = ImageColorAllocate($im, 255,255,255); $black = ImageColorAllocate($im, 0, 0, 0); $red = ImageColorAllocate($im, 255, 50, 50); $green = ImageColorAllocate($im, 30, 100, 30); $blue = ImageColorAllocate($im, 50, 50, 255); // DRAW BACKGROUND ImageFilledRectangle($im, 0, 0, $w, $h, $black); ImageFilledRectangle($im, 50, 2, 10, 10, $red); ImageFilledRectangle($im, 0, 24, 10, 10, $blue); ImageFilledRectangle($im, 30, 36, 10, 10, $green); # Output the image to the browser imagejpeg($im); ?> Link to comment https://forums.phpfreaks.com/topic/69386-problems-repeating-image-in-gd/#findComment-348623 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.