JAVA、PHP、前端、APP、网站开发 - 开发技术学习

开发技术学习 » 编程开发 » PHP随机生成imagecolor

PHP随机生成imagecolor

此文被围观4100日期: 2014-01-17 分类 : 编程开发  标签:  ····

PHP随机生成imagecolor  

<?php
//assign random rgb values
$c1 = mt_rand(50,200); //r(ed)
$c2 = mt_rand(50,200); //g(reen)
$c3 = mt_rand(50,200); //b(lue)
//test if we have used up palette
if(imagecolorstotal($pic)>=255) {
//palette used up; pick closest assigned color
$color = imagecolorclosest($pic, $c1, $c2, $c3);
} else {
//palette NOT used up; assign new color
$color = imagecolorallocate($pic, $c1, $c2, $c3);
}
?>


站点声明:部分内容源自互联网,为传播信息之用,如有侵权,请联系我们删除。

© Copyright 2011-2024 www.kfju.com. All Rights Reserved.
超级字帖 版权所有。蜀ICP备12031064号