PHPʵÏÖÔ²½ÇͼƬ
¹¤×÷ÖÐÓõ½£¬×Ô¼ºÐ´ÁËÒ»¸ö£¬·ÖÏí¸øÓÐÐèÒªµÄÈË£¬Ç°ÃæÊÇÀඨÒ壬ºóÃæ2ÐÐÊǵ÷Óá£
Óŵ㣺
²»ÐèÒªÍⲿͼƬ
Ö§³ÖPNG͸Ã÷
¿É×Ô¶¨ÒåÔ²½Ç°ë¾¶
²»×㣺
Ö»ÄÜÖ¸¶¨Ò»ÖÖ͸Ã÷É«
<?php
class RoundedCorner {
private $_r;
private $_g;
private $_b;
private $_image_path;
private $_radius;
function __construct($image_path, $radius, $r = 255, $g = 0, $b = 0) {
$this->_image_path = $image_path;
$this->_radius = $radius;
$this->_r = (int)$r;
$this->_g = (int)$g;
$this->_b = (int)$b;
}
private function _get_lt_rounder_corner() {
$radius = $this->_radius;
$img = imagecreatetruecolor($radius, $radius);
$bgcolor = imagecolorallocate($img, $this->_r, $this->_g, $this->_b);
$fgcolor = imagecolorallocate($img, 0, 0, 0);
imagefill($img, 0, 0, $bgcolor);
imagefilledarc($img, $radius, $radius, $radius*2, $radius*2, 180, 270, $fgcolor, IMG_ARC_PIE);
imagecolortransparent($img, $fgcolor);
return $img;
}
private function _load_source_image() {
$ext = substr($this->_image_path, strrpos($this->_image_path, '.'));
if (empty($ext)) {
return false;
}
switch(strtolower($ext)) {
case '.jpg':
$img = @imagecreatefromjpeg($this->_image_path);
break;
case '.gif':
$img = @imagecreatefromgif($this->_image_path);
break;
case '.png':
$img = @imagecreatefrompng($this->_image_path);
break;
default:
return false;
}
return $img;
}
public function round_it() {
// load the source image
$src_image = $this->_load_source_image();
if ($src_image === false) {
die('Sorry, can\'t load the image');
}
$image_width = imagesx($src_image);
$image_height = imagesy($src_image);
// create a new image, with src_width, src_height, and fill it with transparent color
$image = imagecreatetruecolor($image_width, $image_height);
$trans_color = imagecolorallocate($image, $this->_r, $this->_g, $this->_b
Ïà¹ØÎĵµ£º
ÒÔϹØÓڴ˺¯Êý¸÷ÏîʹÓòÎÊý:
bool curl_setopt (int ch, string option, mixed value)
curl_setopt()º¯Êý½«ÎªÒ»¸öCURL»á»°ÉèÖÃÑ¡Ïî¡£option²ÎÊýÊÇÄãÏëÒªµÄÉèÖã¬valueÊÇÕâ¸öÑ¡Ïî¸ø¶¨µÄÖµ¡£
ÏÂÁÐÑ¡ÏîµÄÖµ½«±»×÷Ϊ³¤ÕûÐÎʹÓÃ(ÔÚoption²ÎÊýÖÐÖ¸¶¨)£º
CURLOPT_INFILESIZE
: µ±ÄãÉÏ´«Ò»¸öÎļþµ½Ô¶³ÌÕ¾µã£¬Õâ¸öÑ¡Ï ......
$_SERVER['PHP_SELF'] #µ±Ç°ÕýÔÚÖ´Ðнű¾µÄÎļþÃû£¬Óë document rootÏà¹Ø¡£
$_SERVER['argv'] #´«µÝ¸ø¸Ã½Å±¾µÄ²ÎÊý¡£
$_SERVER['argc'] #°üº¬´«µÝ¸ø³ÌÐòµÄÃüÁîÐвÎÊýµÄ¸öÊý£¨Èç¹ûÔËÐÐÔÚÃüÁîÐÐģʽ£©¡£
$_SERVER['GATEWAY_INTERFACE'] #·þÎñÆ÷ʹÓÃµÄ CGI ¹æ·¶µÄ°æ±¾¡£ÀýÈ磬“CGI/1.1”¡£
$_SERVER['S ......
ÓÃPHP¹ýÂËÌá½»±íµ¥µÄhtml´úÂëÀï¿ÉÄÜÓб»ÀûÓÃÒýÈëÍⲿΣÏÕÄÚÈݵĴúÂë¡£ÀýÈ磬ÓÐЩʱºòÓû§Ìá½»±íµ¥Öк¬ÓÐhtmlÄÚÈÝ£¬µ«Õâ¿ÉÄÜÔì³ÉÏÔÊ¾Ò³Ãæ²¼¾Ö»ìÂÒ£¬ÐèÒª¹ýÂ˵ô¡£
ÒÔÏÂÊdzÌÐò´úÂ룺
¸´ÖÆ´úÂë
function uhtml($str)
{
$farr = array(
......
½üÔÚѧ[url=javascript:;]PHP[/url],һλÅóÓÑÎʵ½[url=javascript:;]ʱ¼ä[/url]µÄ¼ÆËã,´ËʱÎÒÏëµ½ÁËdelphiºÍmssqlµÄ¼ÆËã[url=javascript:;]º¯Êý[/url],ËüÃÇÓÃÆðÀ´¶¼ºÜ·½±ã,µ«²é²éphpÊֲᲢδ·¢ÏÖÀàËÆµÄʱ¼ä¼ÆË㺯Êý,ͨ¹ýÍøÎĵįô·¢ºÍ×ÔÒѵIJâÊÔ,»¹ÊÇÕÒµ½¼òµ¥µÄ[url=javascript:;]·½·¨[/url]À´ÊµÏÖ 8 =FP92X
¾ßÌåÈ ......
˵Ã÷£ºÒòΪ×î½ü¹¤×÷¹¤×÷¹ØÏµ£¬ÐèÒª¿ª·¢Ò»¸öÔÚLinuxÏÂÔËÐеÄWeb Application£¬ÐèÒª¶ÔÏÖÔڱȽÏÁ÷ÐеÄһЩPHP¿ò¼Ü×öÒ»¸öÁ˽âºÍÆÀ¹À£¬ÏÂÃæµÄÕâÆªÎÄÕÂÊDZÊÕß×î½üѧϰһ¸ö±È½ÏеÄPHP FrameworkµÄÒ»µã¾ÀúºÍ²Ù×÷²½Ö裬ÒòΪ¹Ù·½µÄÊÖ²áдµÃ±È½Ï»Þɬ£¨ÌرðÊÇÖÐÎĵģ©£¬Ôø¾³¢ÊÔ±é¶ÁËüÄǸöÊÖ²áÔÙ¶¯ÊÖ£¬¶ÁÁËÒ»´ó°ë·¢ÏÖÈÔÎÞ·¨Àí½â£¬ÓÚÊÇ ......