Rumah > Artikel > pembangunan bahagian belakang > 搞了两天,没有弄成,宣布失败,求高手帮忙!
搞了两天,没弄成,宣布失败,求高手帮忙!!
下面这个代码,是可以直接把图片处理为四个角都为园的。
但是现在产生的图片是没生成文件的,想改为处理的文件可以生成一个在指定目录。。
弄了两天,总是不行。。。求高手帮忙看看。。谢谢!
例如运行网址:http://www.xxx.com/pic.php?gopic=1234.jpg
pic.php代码如下:
<br> <?php <br /> class RoundedCorner { <br> private $_r; <br> private $_g; <br> private $_b; <br> private $_image_path; <br> private $_radius; <br> <br> function __construct($image_path, $radius, $r = 255, $g = 255, $b = 255) { <br> $this->_image_path = $image_path; <br> $this->_radius = $radius; <br> $this->_r = (int)$r; <br> $this->_g = (int)$g; <br> $this->_b = (int)$b; <br> } <br> <br> private function _get_lt_rounder_corner() { <br> $radius = $this->_radius; <br> $img = imagecreatetruecolor($radius, $radius); <br> $bgcolor = imagecolorallocate($img, $this->_r, $this->_g, $this->_b); <br> $fgcolor = imagecolorallocate($img, 0, 0, 0); <br> imagefill($img, 0, 0, $bgcolor); <br> imagefilledarc($img, $radius, $radius, $radius*2, $radius*2, 180, 270, $fgcolor, IMG_ARC_PIE); <br> imagecolortransparent($img, $fgcolor); <br> return $img; <br> } <br> <br> private function _load_source_image() { <br> $ext = substr($this->_image_path, strrpos($this->_image_path, '.')); <br> if (empty($ext)) { <br> return false; <div class="clear"> </div>