- How do you display multiple images with PHP?
- 14 Jul 2011 06:51:55 pm
- Last edited by kpa4941 on 14 Jul 2011 07:21:37 pm; edited 1 time in total
I have recently looked into how to make PHP images for a project of mine, but I am having a difficult time with it. I am trying to generate a column of 25 squares that are 10 x 10 with each a slightly different color from the other.
I have been able to make a 10 x 10 blue square, but every time I try to run a for loop to make more 10 x 10 squares of different colors, only the blue square is displayed.
This is the code that I am using right now for a blue square
Code:
How can I output multiple of these generated images?
Thanks.
I have been able to make a 10 x 10 blue square, but every time I try to run a for loop to make more 10 x 10 squares of different colors, only the blue square is displayed.
This is the code that I am using right now for a blue square
Code:
<?
header( "Content-type: image/png" );
$my_img = imagecreate( 10, 10 );
$background = imagecolorallocate( $my_img, 0, 0, 255 );
imagepng( $my_img );
imagecolordeallocate( $background );
imagedestroy( $my_img );
?>
How can I output multiple of these generated images?
Thanks.