zoukankan      html  css  js  c++  java
  • GD库常用函数

    创建句柄

    • imagecreate($width, $height)                                                  //新建图像
    • imagecreatefromjpeg($path)                                               //打开已有的图像

    • imagecreatefromgif($path)

    • imagecreatefrompng($path)

    getimagesize($path)                        //获取图像信息

    imagecopyresampled($newImage, $image, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height);// 创建缩略图

    imagearc($image, $cx, $cy, $width, $height, $start, $end, $color) //创建圆

    imagestring($image, $font, $x, $y, $string, $color)        //水平绘制字符串

    imagestringup($image, $font, $x, $y, $string, $color)      //垂直绘制字符串

    $color= imagecolorallocate($image, $red, $green, $blue)     //设置图像颜色

    imagefilledrectangle($image, 0, 0, 100, 100, $white);       //矩形填充

    header("Content-type: image/png");

    imagepng($image);                        //输出png图像(jpeg/gif)

    imagedestroy($image)                       //关闭句柄

    imagecopymerge($dst, $src, 10, 10, 0, 0, $src_w, $src_h, 50);   //图片叠加

    用法:创建验证码,图片添加水印,创建缩略图等

  • 相关阅读:
    VS2010下配置CxImage
    Visual Studio 2010 开发配置
    主机屋使用感受
    Web开发者必备的20款超赞jQuery插件
    自动页面居中
    jQuery+CSS打造的网页背景颜色切换效果
    小按钮,大学问
    【网站开发必备】——12款响应式 Lightbox(灯箱)效果插件
    修正 IE 的双倍页边距 bug
    a>b?a:b
  • 原文地址:https://www.cnblogs.com/docter/p/5984058.html
Copyright © 2011-2022 走看看