当前位置: 首页 > news >正文

企业网站首页设计原则/网站搜索引擎优化方法

企业网站首页设计原则,网站搜索引擎优化方法,大石桥网站制作,写作墨问题 网站工作中用到,自己写了一个,分享给有需要的人,前面是类定义,后面2行是调用。优点:不需要外部图片支持PNG透明可自定义圆角半径不足:只能指定一种透明色class RoundedCorner {private $_r;private $_g;private…

工作中用到,自己写了一个,分享给有需要的人,前面是类定义,后面2行是调用。

优点:

不需要外部图片

支持PNG透明

可自定义圆角半径

不足:

只能指定一种透明色

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);

imagefill($image, 0, 0, $trans_color);

// then overwirte the source image to the new created image

imagecopymerge($image, $src_image, 0, 0, 0, 0, $image_width, $image_height, 100);

// then just copy all the rounded corner images to the 4 corners

$radius = $this->_radius;

// lt

$lt_corner = $this->_get_lt_rounder_corner();

imagecopymerge($image, $lt_corner, 0, 0, 0, 0, $radius, $radius, 100);

// lb

$lb_corner = imagerotate($lt_corner, 90, $trans_color);

imagecopymerge($image, $lb_corner, 0, $image_height - $radius, 0, 0, $radius, $radius, 100);

// rb

$rb_corner = imagerotate($lt_corner, 180, $trans_color);

imagecopymerge($image, $rb_corner, $image_width - $radius, $image_height - $radius, 0, 0, $radius, $radius, 100);

// rt

$rt_corner = imagerotate($lt_corner, 270, $trans_color);

imagecopymerge($image, $rt_corner, $image_width - $radius, 0, 0, 0, $radius, $radius, 100);

// set the transparency

imagecolortransparent($image, $trans_color);

// display it

header('Content-Type: image/png');

imagepng($image);

imagedestroy($src_image);

imagedestroy($image);

imagedestroy($lt_corner);

imagedestroy($lb_corner);

imagedestroy($rb_corner);

imagedestroy($rt_corner);

}

}

$rounder = new RoundedCorner('test.png', 20);

$rounder->round_it();

?>

http://www.lbrq.cn/news/1528867.html

相关文章:

  • php网站留言板模板下载/曲靖百度推广
  • 可以做结构式的网站/搜索引擎优化seo是什么
  • wordpress竖直导航栏/seoul是什么意思
  • 深圳电子商务网站 开发/新余seo
  • 玉溪网站建设网站建设/重庆好的seo平台
  • 常德房产网/权威seo技术
  • 南京公司网站建立/黄山seo排名优化技术
  • 高端的网站设计公司/网站优化推广培训
  • 网站怎么做百度排名/百度经验官网登录
  • 浙江省建设厅证书查询/网站推广优化外包公司
  • 企业网站用视频做首页/排名函数
  • 建筑设计找工作的网站/公司网页制作模板
  • 融资融券配资网站建设/互联网营销平台有哪些
  • wordpress安装说明/太原关键词优化软件
  • 南城网站建设/网店运营推广方案
  • wordpress网站后台/西安seo网站关键词优化
  • 网站做微信链接怎么做的/网络推广官网首页
  • wap网站建设方案 pdf/清理大师
  • 自适应和响应式网站/网络上市场推广
  • 网站代码上传到服务器后要怎么做的/nba排名最新赛程
  • App网站建设 高品质网站建设/舆情视频
  • 学习php网站开发怎么样/营销方法有哪几种
  • 做影视网站须要注意什么/石家庄网站建设seo公司
  • 做网站公司怎么赚钱/免费放单平台无需垫付
  • 购物网站的建设与维护/网上营销策略有哪些
  • 佛山网站制作哪家/百度推广管家登录
  • 辽宁建设工程信息网保函保险服务/seo建站是什么意思
  • 做网站的工具有哪些/枸橼酸西地那非片的作用及功效
  • wordpress增强搜索/seo包括什么
  • 制作一个专门浏览图片的网站/seo关键词外包公司
  • Unreal Engine Simulate Physics
  • go 常见面试题
  • FPGA学习笔记——简单的IIC读写EEPROM
  • 【GaussDB】使用gdb定位GaussDB编译package报错
  • 数据库原理及应用_数据库基础_第2章关系数据库标准语言SQL_数据查询(2)分组查询
  • Qt 中最经典、最常用的多线程通信场景