jason213123 Posted October 25, 2012 Share Posted October 25, 2012 hi i looking for a way to creat a picture like this: http://acp.com.pt/color.png how can i do that? thanks for your help Quote Link to comment https://forums.phpfreaks.com/topic/269901-how-creat-a-square-picture-with-two-colors/ Share on other sites More sharing options...
White_Lily Posted October 25, 2012 Share Posted October 25, 2012 With an image editor. Maaaaaybe CSS... But definitely not php. Quote Link to comment https://forums.phpfreaks.com/topic/269901-how-creat-a-square-picture-with-two-colors/#findComment-1387692 Share on other sites More sharing options...
PFMaBiSmAd Posted October 25, 2012 Share Posted October 25, 2012 If you want to dynamically create an image like that using php, perhaps with different colors..., you would use the GD image library functions - http://us3.php.net/manual/en/book.image.php Quote Link to comment https://forums.phpfreaks.com/topic/269901-how-creat-a-square-picture-with-two-colors/#findComment-1387693 Share on other sites More sharing options...
Jessica Posted October 25, 2012 Share Posted October 25, 2012 Of course you could do that with PHP. Quote Link to comment https://forums.phpfreaks.com/topic/269901-how-creat-a-square-picture-with-two-colors/#findComment-1387696 Share on other sites More sharing options...
White_Lily Posted October 25, 2012 Share Posted October 25, 2012 I never even knew PFMaBiSmAd's method even existed - that's why I didn't think you could do it with php Quote Link to comment https://forums.phpfreaks.com/topic/269901-how-creat-a-square-picture-with-two-colors/#findComment-1387701 Share on other sites More sharing options...
Jessica Posted October 25, 2012 Share Posted October 25, 2012 Anything is possible. You just have to figure out how to do it. Quote Link to comment https://forums.phpfreaks.com/topic/269901-how-creat-a-square-picture-with-two-colors/#findComment-1387702 Share on other sites More sharing options...
Barand Posted October 25, 2012 Share Posted October 25, 2012 I never even knew PFMaBiSmAd's method even existed - that's why I didn't think you could do it with php <?php $im = imagecreate (50,50); $red = imagecolorallocate($im, 0xFF, 0, 0); $grn = imagecolorallocate($im, 0, 0xFF, 0); $blk = imagecolorallocate($im, 0, 0, 0); $pts = array (0, 0, 0, 49, 49, 0); imagefilledpolygon($im, $pts, 3, $grn); imagerectangle($im, 0, 0, 49, 49, $blk); header("content-type: image/png"); imagepng($im); imagedestroy($im); ?> Quote Link to comment https://forums.phpfreaks.com/topic/269901-how-creat-a-square-picture-with-two-colors/#findComment-1387722 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.