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);   //图片叠加

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

  • 相关阅读:
    count(*) 和 count(1)和count(列名)区别
    网页横向滚动条
    发送公众号模板消息
    tp中S与session()
    php 判断sql执行时间
    thinkphp联查
    php 获取当前时间
    微信分享
    测试用手机奇怪问题
    翻译|多少植物才能净化室内空气?
  • 原文地址:https://www.cnblogs.com/docter/p/5984058.html
Copyright © 2011-2022 走看看