php常用图片处理类

 更新时间:2016年11月25日 16:57  点击:1510
我们经常在对图像操作时会要有水印 略缩图并且水印可以指定到可以选,1代表左上,2代表左中,3代表左右,4代表中左,5代表中中,6代表中右,7代表下做,8代表下中,9代表下右,0代表随机位置
 代码如下 复制代码

<?php
/*已知问题:1.在图片缩放功能中,使用imagecreatetruecolor函数创建画布,并使用透明处理算法,但PNG格式的图片无法透明。用imagecreate函数创建画布可以解决这个问题,但是缩放出来的图片色数太少了
*
*
*type值:
* (1):代表使用图片缩放功能,此时,$value1代表缩放后图片的宽度,$value2代表缩放后图片的高度
* (2):代表使用图片裁剪功能,此时,$value1代表裁剪开始点的坐标,例:从原点开始即是“0,0”前面是x轴后面是y轴,中间用,分隔,$value2代表裁剪的宽度和高度,同样也是“20,20”的形式使用
* (3):代表使用加图片水印功能,此时,$value1代表水印图片的文件名,$value2代表水印在图片中的位置,有10值个可以选,1代表左上,2代表左中,3代表左右,4代表中左,5代表中中,6代表中右,7代表下做,8代表下中,9代表下右,0代表随机位置
*
*/
class image{
private $types; //使用的功能编号,1为图片缩放功能 2为图片裁剪功能 3,为图片加图片水印功能
private $imgtype;//图片的格式
private $image; //图片资源
private $width;//图片宽度
private $height;//图片高度
private $value1;//根据所传type值的不同,$value1分别代表不同的值
private $value2;//根据所传type值的不同,$value2分别代表不同的值
private $endaddress;//输出后的地址+文件名
function __construct($imageaddress, $types, $value1="", $value2="", $endaddress){
$this->types=$types;
$this->image=$this->imagesources($imageaddress);
$this->width=$this->imagesizex();
$this->height=$this->imagesizey();
$this->value1=$value1;
$this->value2=$value2;
$this->endaddress=$endaddress;
}
function outimage(){ //根据传入type值的不同,输出不同的功能
switch($this->types){
case 1:
$this->scaling();
break;
case 2:
$this->clipping();
break;
case 3:
$this->imagewater();
break;
default:
return false;
}
}
private function imagewater(){ //加图片水印功能
//用函数获取水印文件的长和宽
$imagearrs=$this->getimagearr($this->value1);
//调用函数计算出水印加载的位置
$positionarr=$this->position($this->value2, $imagearrs[0], $imagearrs[1]);
//加水印
imagecopy($this->image, $this->imagesources($this->value1), $positionarr[0], $positionarr[1], 0, 0, $imagearrs[0], $imagearrs[1]);
//调用输出方法保存
$this->output($this->image);
}
private function clipping(){ //图片裁剪功能
//将传进来的值分别赋给变量
list($src_x, $src_y)=explode(",", $this->value1);
list($dst_w, $dst_h)=explode(",", $this->value2);
if($this->width < $src_x+$dst_w || $this->height < $src_y+$dst_h){ //这个判断就是限制不能截取到图片外面去
return false;
}
//创建新的画布资源
$newimg=imagecreatetruecolor($dst_w, $dst_h);
//进行裁剪
imagecopyresampled($newimg, $this->image, 0, 0, $src_x, $src_y, $dst_w, $dst_h, $dst_w, $dst_h);
//调用输出方法保存
$this->output($newimg);
}
private function scaling(){ //图片缩放功能
//获取等比缩放的宽和高
$this-> proimagesize();
//根据参数进行缩放,并调用输出函数保存处理后的文件
$this->output($this->imagescaling());
}
private function imagesources($imgad){ //获取图片类型并打开图像资源
$imagearray=$this->getimagearr($imgad);
switch($imagearray[2]){
case 1://gif
$this->imgtype=1;
$img=imagecreatefromgif($imgad);
break;
case 2://jpeg
$this->imgtype=2;
$img=imagecreatefromjpeg($imgad);
break;
case 3://png
$this->imgtype=3;
$img=imagecreatefrompng($imgad);
break;
default:
return false;
}
return $img;
}
private function imagesizex(){ //获得图片宽度
return imagesx($this->image);
}
private function imagesizey(){ //获取图片高度
return imagesy($this->image);
}
private function proimagesize(){ //计算等比缩放的图片的宽和高
if($this->value1 && ($this->width < $this->height)) { //等比缩放算法
$this->value1=round(($this->value2/ $this->height)*$this->width);
}else{
$this->value2=round(($this->value1/ $this->width) * $this->height);
}
}
private function imagescaling(){//图像缩放功能,返回处理后的图像资源
$newimg=imagecreatetruecolor($this->value1, $this->value2);
$tran=imagecolortransparent($this->image);//处理透明算法
if($tran >= 0 && $tran < imagecolorstotal($this->image)){
$tranarr=imagecolorsforindex($this->image, $tran);
$newcolor=imagecolorallocate($newimg, $tranarr['red'], $tranarr['green'], $tranarr['blue']);
imagefill($newimg, 0, 0, $newcolor);
imagecolortransparent($newimg, $newcolor);
}
imagecopyresampled($newimg, $this->image, 0, 0, 0, 0, $this->value1, $this->value2, $this->width, $this->height);
return $newimg;
}
private function output($image){//输出图像
switch($this->imgtype){
case 1:
imagegif($image, $this->endaddress);
break;
case 2:
imagejpeg($image, $this->endaddress);
break;
case 3:
imagepng($image, $this->endaddress);
break;
default:
return false;
}
}
private function getimagearr($imagesou){//返回图像属性数组方法
return getimagesize($imagesou);
}
private function position($num, $width, $height){//根据传入的数字返回一个位置的坐标,$width和$height分别代表插入图像的宽和高
switch($num){
case 1:
$positionarr[0]=0;
$positionarr[1]=0;
break;
case 2:
$positionarr[0]=($this->width-$width)/2;
$positionarr[1]=0;
break;
case 3:
$positionarr[0]=$this->width-$width;
$positionarr[1]=0;
break;
case 4:
$positionarr[0]=0;
$positionarr[1]=($this->height-$height)/2;
break;
case 5:
$positionarr[0]=($this->width-$width)/2;
$positionarr[1]=($this->height-$height)/2;
break;
case 6:
$positionarr[0]=$this->width-$width;
$positionarr[1]=($this->height-$height)/2;
break;
case 7:
$positionarr[0]=0;
$positionarr[1]=$this->height-$height;
break;
case 8:
$positionarr[0]=($this->width-$width)/2;
$positionarr[1]=$this->height-$height;
break;
case 9:
$positionarr[0]=$this->width-$width;
$positionarr[1]=$this->height-$height;
break;
case 0:
$positionarr[0]=rand(0, $this->width-$width);
$positionarr[1]=rand(0, $this->height-$height);
break;
}
return $positionarr;
}
function __destruct(){
imagedestroy($this->image);
}
}
?>
这里是自己的学习时的验证码图形生成的学习笔记,后来经过自己的深入学习,可以获取远程的图片到本地,不过这里需要php gd库开启哦。
 代码如下 复制代码

header("Content-type:image/png");
set_time_limit(0);//设置PHP超时时间
$url = $_GET['url'];
$url = "http://vcer.baidu.com/verify";
$imginfo = GetImageSize ( $url );  
$imgw = $imginfo [0];  
$imgh = $imginfo [1];
$bg = imagecreatetruecolor($imgw,$imgh);
$image = imagecreatefromjpeg($url);
imagecolorallocate($image,255,255,255);
imagecopy($bg,$image,0,0, 0,0,$imgw,$imgh);
imagedestroy($image);
ImagePng($bg);

获取远程验证码到本地

 代码如下 复制代码

header("Content-type:image/png");
set_time_limit(0);//设置PHP超时时间
$url = $_GET['url'];
$url = "http://vcer.baidu.com/verify";
if(empty($url)){
 echo "没有图片";
 die;
}
$imginfo = GetImageSize ( $url );  
$type = exif_imagetype($url);
$imgw = $imginfo [0];  
$imgh = $imginfo [1];
$bg = imagecreatetruecolor($imgw,$imgh);
if($type==IMAGETYPE_GIF){
 $image = imagecreatefromgif($url);
}elseif($type==IMAGETYPE_JPEG){
 $image = imagecreatefromjpeg($url);
}elseif($type==IMAGETYPE_PNG){
 $image = imagecreatefrompng($url);
}
 
imagecolorallocate($image,255,255,255);
imagecopy($bg,$image,0,0, 0,0,$imgw,$imgh);
imagedestroy($image);
ImagePng($bg);

本款邮件发送功能我们是用了国外一个开源码的邮件类,大家都可能用过的PHPMailer邮件类很简单,今天来讲一下简单的使用教程,有需要的朋友可以参考下,同时像其它的附件什么的,各位朋友可以给我意见哦。

要注意的内容:
  1. 邮件的字符集设置, $mail->CharSet = "GB2312";            // 这里指定字符集!在这里我只指定为GB2312因为这样Outlook能正常显示邮件主题,我尝试过设为utf-8但在Outlook下显示乱码。
  2. 如果是发送html格式的邮件,那么记得也指定<meta ... charset=GB2312">
  3. 如果你想用它来群发邮件的话,记得修改包含文件函数,如:
  require("phpmailer/class.phpmailer.php");
  改为
  require_once("phpmailer/class.phpmailer.php");
  否则的话会产生类的重定义。

 

 代码如下 复制代码

<?php
/*******************************
*    作者:李英江
* 日期:2006-12-7
*******************************/
require("phpmailer/class.phpmailer.php");
function smtp_mail ( $sendto_email, $subject, $body, $extra_hdrs, $user_name) {
$mail = new PHPMailer();
$mail->IsSMTP();                // send via SMTP
$mail->Host = "200.162.244.66"; // SMTP servers
$mail->SMTPAuth = true;         // turn on SMTP authentication
$mail->Username = "yourmail";   // SMTP username  注意:普通邮件认证不需要加 @域名
$mail->Password = "mailPassword";        // SMTP password
$mail->From = "yourmail@cgsir.com";      // 发件人邮箱
$mail->FromName =  "cgsir.com管理员";  // 发件人

$mail->CharSet = "GB2312";            // 这里指定字符集!
$mail->Encoding = "base64";
$mail->AddAddress($sendto_email,"username");  // 收件人邮箱和姓名
$mail->AddReplyTo("yourmail@cgsir.com","cgsir.com");
//$mail->WordWrap = 50; // set word wrap
//$mail->AddAttachment("/var/tmp/file.tar.gz"); // attachment
//$mail->AddAttachment("/tmp/image.jpg", "new.jpg");
$mail->IsHTML(true);  // send as HTML
        // 邮件主题
$mail->Subject = $subject;
// 邮件内容
$mail->Body = '
<html><head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=GB2312">
</head>
<body>
        欢迎来到<a href="http://www.111cn.net">http://www.111cn.net</a> <br /><br />
感谢您注册为本站会员!<br /><br />
</body>
</html>
';                                                                      
$mail->AltBody ="text/html";
if(!$mail->Send())
{
  echo "邮件发送有误 <p>";
  echo "邮件错误信息: " . $mail->ErrorInfo;
  exit;
}
else {
  echo "$user_name 邮件发送成功!<br />";
}
}
// 参数说明(发送到, 邮件主题, 邮件内容, 附加信息, 用户名)
smtp_mail('yourmail@cgsir.com', '欢迎来到cgsir.com!', 'NULL', 'cgsir.com', 'username');
?>

需要下载PHPMailer文件包phpmailer-1.73.tar.gz   来自开源社区: http://phpmailer.sourceforge.net/

从国外网站找到的一款php生成缩略图代码,有需要的朋友可以参考一下。
 代码如下 复制代码
<?php
 
/*
* File: SimpleImage.php
* Author: Simon Jarvis
* Copyright: 2006 Simon Jarvis
* Date: 08/11/06
* Link: http://www.white-hat-web-design.co.uk/articles/php-image-resizing.php
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details:
* http://www.gnu.org/licenses/gpl.html
*
*/
 
class SimpleImage {
 
   var $image;
   var $image_type;
 
   function load($filename) {
 
      $image_info = getimagesize($filename);
      $this->image_type = $image_info[2];
      if( $this->image_type == IMAGETYPE_JPEG ) {
 
         $this->image = imagecreatefromjpeg($filename);
      } elseif( $this->image_type == IMAGETYPE_GIF ) {
 
         $this->image = imagecreatefromgif($filename);
      } elseif( $this->image_type == IMAGETYPE_PNG ) {
 
         $this->image = imagecreatefrompng($filename);
      }
   }
   function save($filename, $image_type=IMAGETYPE_JPEG, $compression=75, $permissions=null) {
 
      if( $image_type == IMAGETYPE_JPEG ) {
         imagejpeg($this->image,$filename,$compression);
      } elseif( $image_type == IMAGETYPE_GIF ) {
 
         imagegif($this->image,$filename);
      } elseif( $image_type == IMAGETYPE_PNG ) {
 
         imagepng($this->image,$filename);
      }
      if( $permissions != null) {
 
         chmod($filename,$permissions);
      }
   }
   function output($image_type=IMAGETYPE_JPEG) {
 
      if( $image_type == IMAGETYPE_JPEG ) {
         imagejpeg($this->image);
      } elseif( $image_type == IMAGETYPE_GIF ) {
 
         imagegif($this->image);
      } elseif( $image_type == IMAGETYPE_PNG ) {
 
         imagepng($this->image);
      }
   }
   function getWidth() {
 
      return imagesx($this->image);
   }
   function getHeight() {
 
      return imagesy($this->image);
   }
   function resizeToHeight($height) {
 
      $ratio = $height / $this->getHeight();
      $width = $this->getWidth() * $ratio;
      $this->resize($width,$height);
   }
 
   function resizeToWidth($width) {
      $ratio = $width / $this->getWidth();
      $height = $this->getheight() * $ratio;
      $this->resize($width,$height);
   }
 
   function scale($scale) {
      $width = $this->getWidth() * $scale/100;
      $height = $this->getheight() * $scale/100;
      $this->resize($width,$height);
   }
 
   function resize($width,$height) {
      $new_image = imagecreatetruecolor($width, $height);
      imagecopyresampled($new_image, $this->image, 0, 0, 0, 0, $width, $height, $this->getWidth(), $this->getHeight());
      $this->image = $new_image;
   }     
 
}
?>


Usage
Save the above file as SimpleImage.php and take a look at the following examples of how to use the script.

The first example below will load a file named picture.jpg resize it to 250 pixels wide and 400 pixels high and resave it as picture2.jpg

 代码如下 复制代码

<?php
   include('SimpleImage.php');
   $image = new SimpleImage();
   $image->load('picture.jpg');
   $image->resize(250,400);
   $image->save('picture2.jpg');
?>

If you want to resize to a specifed width but keep the dimensions ratio the same then the script can work out the required height for you, just use the resizeToWidth function

 代码如下 复制代码

<?php
   include('SimpleImage.php');
   $image = new SimpleImage();
   $image->load('picture.jpg');
   $image->resizeToWidth(250);
   $image->save('picture2.jpg');
?>

一款实现的生成小图功能的实现代码,有需要的朋友可以参考,每个都有详细的说明参数。
 代码如下 复制代码

<form action="uploads.php" method="post" enctype="multipart/form-data">
 <input type='file' name='image'><br>
 <input type='submit' name='sub' value='提交'>
</form>

uploads.php文件

<?php
class image_upload{
 private $srcimg;  //原图片
 private $destimg;  // 目标图片
 private $width;   //原图片的宽度
 private $height;  //原图片的高度
 private $type;   //原文件的图片类型
 private $thumb_width;  //缩略图的宽度
 private $thumb_height; //缩略图的高度
 private $cut;   //是否剪切图片到指定高度
 private $tmp;   //上传图片的临时地址
 private $error;
 private $im;   // 创建一个临时的图片句柄
 private $new_name;  //上传文件的新名字
 
 function __construct($srcimg,$t_width,$t_height,$cut,$tmp,$error){
  $this->srcimg=$srcimg;
  $this->thumb_width=$t_width;
  $this->thumb_height=$t_height;
  $this->cut=$cut;
  $this->tmp=$tmp;
  $this->error=$error;
  $this->get_srcimg_type();
  $this->get_new_upload_name();
  

   }
  
 function img_upload(){
  //文件上传的方法 
  $this->check_error($this->error);
  $this->in_type();
  $dst_dir='./images';
  if(!is_dir($dst_dir)){
   mkdir($dst_dir);
   echo "%%%<BR>";
  }
  
  if(is_uploaded_file($this->tmp)){
   if(move_uploaded_file($this->tmp, $this->new_name)){
    echo "文件上传成功<br>";
    return true;
   }else{
    echo '文件不能被移动,上传失败';
    exit;
   }
  }else{
    echo '文件上传可能被攻击';
    exit;
  }
  
 }
 
 function make_thumbnail(){
  //生成缩略图的方法
  $this->get_dest_imgpath();
  $this->make_im();
  $this->width=imagesx($this->im);
  $this->height=imagesy($this->im);
  
  $thumb_ratio=$this->thumb_width/$this->thumb_height;
  $ratio=$this->width/$this->height;
  
  
  if($this->cut==1){  //是否裁剪
    if($ratio>=$thumb_ratio){
     $img=imagecreatetruecolor($this->thumb_width, $this->thumb_height);
     imagecopyresampled($img, $this->im, 0, 0, 0, 0, $this->thumb_width, $this->thumb_height, $this->height*$thumb_ratio, $this->height);
     imagejpeg($img,$this->destimg);       
     echo "缩略图生成成功";
    }else{
     $img=imagecreatetruecolor($this->thumb_width, $this->thumb_height);
     imagecopyresampled($img, $this->im, 0, 0, 0, 0, $this->thumb_width, $this->thumb_height, $this->width, $this->width/$thumb_ratio);
     imagejpeg($img,$this->destimg);       
     echo "缩略图生成成功";  
    }
  }else{
   if($ratio>=$thumb_ratio){
     $img=imagecreatetruecolor($this->thumb_height*$thumb_ratio, $this->thumb_height);
     imagecopyresampled($img, $this->im, 0, 0, 0, 0, $this->thumb_height*$thumb_ratio, $this->thumb_height, $this->width, $this->height);
     imagejpeg($img,$this->destimg);       
     echo "缩略图生成成功";
   }else{
     $img=imagecreatetruecolor($this->thumb_width, $this->thumb_width/$thumb_ratio);
     imagecopyresampled($img, $this->im, 0, 0, 0, 0, $this->thumb_width, $this->thumb_width/$thumb_ratio, $this->width, $this->height);
     imagejpeg($img,$this->destimg);       
     echo "缩略图生成成功";
   }
  }
  imagedestroy($this->im);
  imagedestroy($img);
 }
 
 private function check_error($error){
  //检查文件上传传得错误;
  if($error>0){
   switch($error){
    case 1:
     echo "上传文件的大小超过了PHP.INI文件中得配置<br>";
     break;
    case 2:
     echo "上传文件的大小超过了表单中的限制大小<br>";
     break;
    case 3:
     echo "只有部分文件被上传<br>";
     break;
    case 4:
     echo "没有文件被上传<br>";
     break;
    case 6:
     echo "php.ini中没有设置图片存放的临时未知<br>";
     break;
    case 7:
     echo "硬盘不可以写入,上传失败<br>";
     break;
    default:
     echo "未知错误";
     break;
   }
  }
 }
 
 private function get_srcimg_type(){
  //判断源文件的图片类型
  $this->type=substr(strrchr($this->srcimg, '.'),'1');
 }
 
 private function in_type(){
  //检查文件是否符合类型
  $type_arr=array('gif','jpg','png');
  if(!in_array($this->type, $type_arr)){
   echo "只支持PNG,GIF,JPG 三种类型的文件格式……,请重新上传正确的格式";
   exit;
  }
 }
 
 private function get_new_upload_name(){
  //上传的文件生成新的名字
  $this->new_name='images/'.date('YmdHis').'.'.$this->type;
 
 }
 private function make_im(){
  //从原文件新建一幅图像
  switch($this->type){
   case 'jpg':
    $this->im=imagecreatefromjpeg($this->new_name);
    break;
   case 'gif':
    $this->im=imagecreatefromgif($this->new_name);
    break;
   case 'png':
    $this->im=imagecreatefrompng($this->new_name);
    break;
   } 
 }
 private function  get_dest_imgpath(){
  //得到缩略图的存储路径
  $len1=strlen($this->new_name);
  $len2=strlen(strrchr($this->new_name,'.'));
  $len3=$len1-$len2;
  $this->destimg=substr($this->new_name,0,$len3).'_small.'.$this->type;
 }
 
}
 print_r($_FILES);
 $file=$_FILES['image'];
echo $file['name'];
 $uploads=new image_upload($file['name'], 120, 160, 1,  $file['tmp_name'],$file['error'] );
  if($uploads->img_upload()){
   $uploads->make_thumbnail();
  }
 
?>


 

[!--infotagslink--]

相关文章

  • Windows批量搜索并复制/剪切文件的批处理程序实例

    这篇文章主要介绍了Windows批量搜索并复制/剪切文件的批处理程序实例,需要的朋友可以参考下...2020-06-30
  • C# 10个常用特性汇总

    这篇文章主要介绍了C# 10个常用特性,文中示例代码非常详细,帮助大家更好的理解和学习,感兴趣的朋友可以了解下...2020-07-09
  • BAT批处理判断服务是否正常运行的方法(批处理命令综合应用)

    批处理就是对某对象进行批量的处理,通常被认为是一种简化的脚本语言,它应用于DOS和Windows系统中。这篇文章主要介绍了BAT批处理判断服务是否正常运行(批处理命令综合应用),需要的朋友可以参考下...2020-06-30
  • PHP file_get_contents设置超时处理方法

    file_get_contents的超时处理话说,从PHP5开始,file_get_content已经支持context了(手册上写着:5.0.0 Added the context support. ),也就是说,从5.0开始,file_get_contents其实也可以POST数据。今天说的这篇是讲超时的,确实在...2013-10-04
  • C#多线程中的异常处理操作示例

    这篇文章主要介绍了C#多线程中的异常处理操作,涉及C#多线程及异常的捕获、处理等相关操作技巧,需要的朋友可以参考下...2020-06-25
  • postgresql 中的时间处理小技巧(推荐)

    这篇文章主要介绍了postgresql 中的时间处理小技巧(推荐),本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下...2021-03-29
  • Python同时处理多个异常的方法

    这篇文章主要介绍了Python同时处理多个异常的方法,文中讲解非常细致,代码帮助大家更好的理解和学习,感兴趣的朋友可以了解下...2020-07-29
  • C#异常处理中try和catch语句及finally语句的用法示例

    这篇文章主要介绍了C#异常处理中try和catch语句及finally语句的用法示例,finally语句的使用涉及到了C#的垃圾回收特性,需要的朋友可以参考下...2020-06-25
  • python用moviepy对视频进行简单的处理

    这篇文章主要介绍了python如何用moviepy对视频进行简单的处理,帮助大家更好的利用python处理视频,感兴趣的朋友可以了解下...2021-03-11
  • C#异常处理详解

    这篇文章介绍了C#异常处理,有需要的朋友可以参考一下...2020-06-25
  • sql server日志处理不当造成的隐患详解

    这篇文章主要给大家介绍了关于sql server日志处理不当造成的隐患的相关资料,文中通过示例代码介绍的非常详细,对大家学习或者使用sql server具有一定的参考学习价值,需要的朋友们下面来一起学习学习吧...2020-07-11
  • Spring MVC 处理一个请求的流程

    Spring MVC是Spring系列框架中使用频率最高的部分。不管是Spring Boot还是传统的Spring项目,只要是Web项目都会使用到Spring MVC部分。因此程序员一定要熟练掌握MVC部分。本篇博客简要分析Spring MVC处理一个请求的流程。...2021-02-06
  • go语言中的Carbon库时间处理技巧

    这篇文章主要介绍了go语言中的Carbon库时间处理,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下...2021-02-05
  • C++异常处理入门(try和catch)

    C++ 提供了异常机制,让我们能够捕获运行时错误,本文就详细的介绍了C++异常处理入门,具有一定的参考价值,感兴趣的小伙伴们可以参考一下...2021-08-09
  • C#事务处理(Execute Transaction)实例解析

    这篇文章主要介绍了C#事务处理(Execute Transaction)实例解析,对于理解和学习事务处理有一定的帮助,需要的朋友可以参考下...2020-06-25
  • php图像处理(缩放、剪裁、缩放、翻转、旋转、透明、锐化)

    本文章来给各同学总结了一些常用的图像处理函数,包括有缩放、剪裁、缩放、翻转、旋转、透明、锐化功能,大家可参考参考。 注意事项:如果要使用php gd处理我们需要...2016-11-25
  • Python编程OpenCV和Numpy图像处理库实现图片去水印

    这篇文章主要介绍了Python编程中如何实现图片去水印本文采用了OpenCV和Numpy的图像处理的方法来实现,文中附含详细示例代码,有需要的朋友可以借鉴参考下...2021-09-26
  • javascript表单处理具体实现代码(表单、链接、按钮)

    这篇文章主要介绍了javascript表单处理具体实现代码,包括各种表单、链接、按钮控件介绍,感兴趣的朋友可以参考一下...2016-05-09
  • JavaScript 事件流、事件处理程序及事件对象总结

    JS与HTML之间的交互通过事件实现。事件就是文档或浏览器窗口中发生的一些特定的交互瞬间。可以使用监听器(或处理程序)来预定事件,以便事件发生时执行相应的代码。本文将介绍JS事件相关的基础知识。...2017-04-03
  • C++之异常处理详解

    C++中处理异常的过程是这样的:在执行程序发生异常,可以不在本函数中处理,而是抛出一个错误信息,把它传递给上一级的函数来解决,上一级解决不了,再传给其上一级,由其上一级处理...2020-04-25