对图片进行压缩,水印,伸缩变换,透明处理,格式转换操作

对图片进行压缩,水印,伸缩变换,透明处理,格式转换操作

 

  1 /**
  2  * <html>
  3  * <body>
  4  *  <P> Copyright 1994 JsonInternational</p>
  5  *  <p> All rights reserved.</p>
  6  *  <p> Created on 19941115</p>
  7  *  <p> Created by Jason</p>
  8  *  </body>
  9  * </html>
 10  */
 11 package cn.ucaner.alpaca.framework.utils.image;
 12 
 13 import java.awt.AlphaComposite;
 14 import java.awt.Color;
 15 import java.awt.Font;
 16 import java.awt.Graphics2D;
 17 import java.awt.Image;
 18 import java.awt.color.ColorSpace;
 19 import java.awt.image.BufferedImage;
 20 import java.awt.image.ColorConvertOp;
 21 import java.io.File;
 22 import java.io.FileInputStream;
 23 import java.io.IOException;
 24 
 25 import javax.imageio.ImageIO;
 26 
 27 /**
 28 * @Package:cn.ucaner.common.utils.image   
 29 * @ClassName:ImageUtil   
 30 * @Description:   <p> 对图片进行压缩,水印,伸缩变换,透明处理,格式转换操作 </p>
 31 * @Author: - Jason 
 32 * @CreatTime:2017年10月26日 上午10:52:22   
 33 * @Modify By:   
 34 * @ModifyTime:  
 35 * @Modify marker:   
 36 * @version    V1.0
 37  */
 38 public class ImageUtil {
 39 
 40     public static final float DEFAULT_QUALITY = 0.2125f ;
 41     
 42     /**
 43      * 添加图片水印操作(物理存盘,使用默认格式)
 44      * @param imgPath  待处理图片
 45      * @param markPath 水印图片
 46      * @param x 水印位于图片左上角的 x 坐标值
 47      * @param y 水印位于图片左上角的 y 坐标值
 48      * @param alpha  水印透明度 0.1f ~ 1.0f
 49      * @param destPath  文件存放路径  
 50      * @throws Exception          
 51      * 
 52      */
 53      public static void addWaterMark(String imgPath, String markPath, int x, int y, float alpha,String destPath) throws Exception{
 54          try {
 55                 BufferedImage bufferedImage = addWaterMark(imgPath, markPath, x, y, alpha);
 56                 ImageIO.write(bufferedImage, imageFormat(imgPath), new File(destPath));
 57             } catch (Exception e) {
 58                 throw new RuntimeException("添加图片水印异常");
 59             }
 60      }
 61     
 62         
 63     /**
 64      * 添加图片水印操作(物理存盘,自定义格式)
 65      * @param imgPath 待处理图片
 66      * @param markPath 水印图片
 67      * @param x 水印位于图片左上角的 x 坐标值
 68      * @param y 水印位于图片左上角的 y 坐标值
 69      * @param alpha 水印透明度 0.1f ~ 1.0f
 70      * @param format  添加水印后存储的格式
 71      * @param destPath  文件存放路径  
 72      * @throws Exception          
 73      * 
 74      */
 75      public static void addWaterMark(String imgPath, String markPath, int x, int y, float alpha,String format,String destPath) throws Exception{
 76          try {
 77                 BufferedImage bufferedImage = addWaterMark(imgPath, markPath, x, y, alpha);
 78                 ImageIO.write(bufferedImage,format , new File(destPath));
 79             } catch (Exception e) {
 80                 throw new RuntimeException("添加图片水印异常");
 81             }
 82      }
 83     
 84      
 85     /**
 86      * 添加图片水印操作,返回BufferedImage对象
 87      * @param imgPath 待处理图片
 88      * @param markPath 水印图片
 89      * @param x 水印位于图片左上角的 x 坐标值
 90      * @param y 水印位于图片左上角的 y 坐标值
 91      * @param alpha 水印透明度 0.1f ~ 1.0f
 92      * @return 处理后的图片对象
 93      * @throws Exception          
 94      * 
 95      */
 96     public static BufferedImage addWaterMark(String imgPath, String markPath, int x, int y, float alpha) throws Exception{
 97         BufferedImage targetImage = null;
 98         try {
 99                         // 加载待处理图片文件
100             Image img = ImageIO.read(new File(imgPath));
101 
102                         //创建目标图象文件
103             targetImage = new BufferedImage(img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_INT_RGB);
104             Graphics2D g = targetImage.createGraphics();
105             g.drawImage(img, 0, 0, null);
106             
107                         // 加载水印图片文件
108             Image markImg = ImageIO.read(new File(markPath));
109             g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, alpha));
110             g.drawImage(markImg, x, y, null);
111             g.dispose();
112         } catch (Exception e) {
113             throw new RuntimeException("添加图片水印操作异常");
114         }
115         return targetImage;
116        
117     }
118 
119     /**
120      * 添加文字水印操作(物理存盘,使用默认格式)
121      * @param imgPath 待处理图片
122      * @param text 水印文字    
123      * @param font 水印字体信息    不写默认值为宋体
124      * @param color 水印字体颜色
125      * @param x 水印位于图片左上角的 x 坐标值
126      * @param y 水印位于图片左上角的 y 坐标值
127      * @param alpha 水印透明度 0.1f ~ 1.0f
128      * @param format 添加水印后存储的格式
129      * @param destPath  文件存放路径     
130      * @throws Exception          
131      */
132     public static void addTextMark(String imgPath, String text, Font font, Color color, float x, float y, float alpha,String destPath) throws Exception{
133         try {
134             BufferedImage bufferedImage = addTextMark(imgPath, text, font, color, x, y, alpha);
135             ImageIO.write(bufferedImage, imageFormat(imgPath), new File(destPath));
136         } catch (Exception e) {
137             throw new RuntimeException("图片添加文字水印异常");
138         }
139     }
140     
141     /**
142      * 添加文字水印操作(物理存盘,自定义格式)
143      * @param imgPath  待处理图片
144      * @param text 水印文字    
145      * @param font 水印字体信息    不写默认值为宋体
146      * @param color 水印字体颜色
147      * @param x 水印位于图片左上角的 x 坐标值
148      * @param y  水印位于图片左上角的 y 坐标值
149      * @param alpha 水印透明度 0.1f ~ 1.0f
150      * @param format 添加水印后存储的格式
151      * @param destPath 文件存放路径     
152      * @throws Exception          
153      */
154     public static void addTextMark(String imgPath, String text, Font font, Color color, float x, float y, float alpha,String format,String destPath) throws Exception{
155         try {
156             BufferedImage bufferedImage = addTextMark(imgPath, text, font, color, x, y, alpha);
157             ImageIO.write(bufferedImage, format, new File(destPath));
158         } catch (Exception e) {
159             throw new RuntimeException("图片添加文字水印异常");
160         }
161     }
162     
163     /**
164      * 添加文字水印操作,返回BufferedImage对象
165      * @param imgPath  待处理图片
166      * @param text 水印文字    
167      * @param font 水印字体信息    不写默认值为宋体
168      * @param color 水印字体颜色
169      * @param x  水印位于图片左上角的 x 坐标值
170      * @param y 水印位于图片左上角的 y 坐标值
171      * @param alpha 水印透明度 0.1f ~ 1.0f
172      * @return  处理后的图片对象
173      * @throws Exception          
174      */
175 
176     public static BufferedImage addTextMark(String imgPath, String text, Font font, Color color, float x, float y, float alpha) throws Exception{
177         BufferedImage targetImage = null;
178         try {
179             Font Dfont = (font == null) ? new Font("宋体", 20, 13) : font;    
180             Image img = ImageIO.read(new File(imgPath));
181                         //创建目标图像文件
182             targetImage = new BufferedImage(img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_INT_RGB);
183             Graphics2D g = targetImage.createGraphics();
184             g.drawImage(img, 0, 0, null);
185             g.setColor(color);
186             g.setFont(Dfont);
187             g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, alpha));
188             g.drawString(text, x, y);
189             g.dispose();
190         } catch (Exception e) {
191             throw new RuntimeException("添加文字水印操作异常");
192         }
193         return targetImage;
194     }
195     
196     /**
197      * 压缩图片操作(文件物理存盘,使用默认格式)
198      * @param imgPath  待处理图片
199      * @param quality  图片质量(0-1之間的float值)
200      * @param width  输出图片的宽度    输入负数参数表示用原来图片宽
201      * @param height  输出图片的高度    输入负数参数表示用原来图片高
202      * @param autoSize  是否等比缩放 true表示进行等比缩放 false表示不进行等比缩放
203      * @param format 压缩后存储的格式
204      * @param destPath 文件存放路径
205      * 
206      * @throws Exception
207      */
208     public static void compressImage(String imgPath,float quality,int width, int height, boolean autoSize,String destPath)throws Exception{
209         try {
210             BufferedImage bufferedImage = compressImage(imgPath, quality, width, height, autoSize);
211             ImageIO.write(bufferedImage, imageFormat(imgPath), new File(destPath));
212         } catch (Exception e) {
213             throw new RuntimeException("图片压缩异常");
214         }
215         
216     }
217     
218     /**
219      * 压缩图片操作(文件物理存盘,可自定义格式)
220      * @param imgPath 待处理图片
221      * @param quality  图片质量(0-1之間的float值)
222      * @param width 输出图片的宽度    输入负数参数表示用原来图片宽
223      * @param height   输出图片的高度    输入负数参数表示用原来图片高
224      * @param autoSize  是否等比缩放 true表示进行等比缩放 false表示不进行等比缩放
225      * @param format   压缩后存储的格式
226      * @param destPath  文件存放路径
227      * 
228      * @throws Exception
229      */
230     public static void compressImage(String imgPath,float quality,int width, int height, boolean autoSize,String format,String destPath)throws Exception{
231         try {
232             BufferedImage bufferedImage = compressImage(imgPath, quality, width, height, autoSize);
233             ImageIO.write(bufferedImage, format, new File(destPath));
234         } catch (Exception e) {
235             throw new RuntimeException("图片压缩异常");
236         }
237     }
238     
239     
240     /**
241      * 压缩图片操作,返回BufferedImage对象
242      * @param imgPath 待处理图片
243      * @param quality 图片质量(0-1之間的float值)
244      * @param width  输出图片的宽度    输入负数参数表示用原来图片宽
245      * @param height 输出图片的高度    输入负数参数表示用原来图片高
246      * @param autoSize  是否等比缩放 true表示进行等比缩放 false表示不进行等比缩放
247      * @return 处理后的图片对象
248      * @throws Exception
249      */
250     public static BufferedImage compressImage(String imgPath,float quality,int width, int height, boolean autoSize)throws Exception{
251         BufferedImage targetImage = null;
252         if(quality<0F||quality>1F){
253             quality = DEFAULT_QUALITY;
254         }
255         try {
256             Image img = ImageIO.read(new File(imgPath));
257                         //如果用户输入的图片参数合法则按用户定义的复制,负值参数表示执行默认值
258             int newwidth =( width > 0 ) ? width : img.getWidth(null);
259                         //如果用户输入的图片参数合法则按用户定义的复制,负值参数表示执行默认值
260             int newheight = ( height > 0 )? height: img.getHeight(null);    
261                         //如果是自适应大小则进行比例缩放
262             if(autoSize){                                                    
263                         // 为等比缩放计算输出的图片宽度及高度
264                 double Widthrate = ((double) img.getWidth(null)) / (double) width + 0.1;
265                 double heightrate = ((double) img.getHeight(null))/ (double) height + 0.1;
266                 double rate = Widthrate > heightrate ? Widthrate : heightrate;
267                 newwidth = (int) (((double) img.getWidth(null)) / rate);
268                 newheight = (int) (((double) img.getHeight(null)) / rate);
269             }
270                         //创建目标图像文件
271             targetImage = new BufferedImage(newwidth,newheight,BufferedImage.TYPE_INT_RGB);
272             Graphics2D g = targetImage.createGraphics();
273             g.drawImage(img, 0, 0, newwidth, newheight, null);
274                         //如果添加水印或者文字则继续下面操作,不添加的话直接返回目标文件----------------------
275             g.dispose();
276             
277         } catch (Exception e) {
278             throw new RuntimeException("图片压缩操作异常");
279         }
280         return targetImage;
281     }
282     
283     /**
284      * 图片黑白化操作(文件物理存盘,使用默认格式)
285      * @param bufferedImage 处理的图片对象
286      * @param destPath 目标文件地址
287      * @throws Exception  
288      *
289      */
290     public static void imageGray(String imgPath, String destPath)throws Exception{
291         imageGray(imgPath, imageFormat(imgPath), destPath);
292     }
293     
294     
295     /**
296      * 图片黑白化操作(文件物理存盘,可自定义格式)
297      * @param bufferedImage 处理的图片对象
298      * @param format  图片格式
299      * @param destPath  目标文件地址
300      * @throws Exception 
301      * 
302      */
303     public static void imageGray(String imgPath,String format, String destPath)throws Exception{
304         try {
305              BufferedImage bufferedImage = ImageIO.read(new File(imgPath));
306              ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY);            
307              ColorConvertOp op = new ColorConvertOp(cs, null);  
308              bufferedImage = op.filter(bufferedImage, null);
309              ImageIO.write(bufferedImage, format , new File(destPath));
310         } catch (Exception e) {
311             throw new RuntimeException("图片灰白化异常");
312         }
313     }
314     
315     
316     
317     /**
318      * 图片透明化操作(文件物理存盘,使用默认格式)
319      * @param imgPath  图片路径
320      * @param destPath  图片存放路径
321      * @throws Exception
322      */
323     public static void imageLucency(String imgPath,String destPath)throws Exception{
324         try {
325             BufferedImage bufferedImage = imageLucency(imgPath);
326             ImageIO.write(bufferedImage, imageFormat(imgPath), new File(destPath));
327         } catch (Exception e) {
328             throw new RuntimeException("图片透明化异常");
329         }
330     }
331     
332     
333     /**
334      * 图片透明化操作(文件物理存盘,可自定义格式)
335      * @param imgPath  图片路径
336      * @param format 图片格式
337      * @param destPath  图片存放路径
338      * @throws Exception
339      */
340     public static void imageLucency(String imgPath,String format,String destPath)throws Exception{
341         try {
342             BufferedImage bufferedImage = imageLucency(imgPath);
343             ImageIO.write(bufferedImage, format, new File(destPath));
344         } catch (Exception e) {
345             throw new RuntimeException("图片透明化异常");
346         }
347     }
348     
349     /**
350      * 图片透明化操作返回BufferedImage对象
351      * @param imgPath  图片路径
352      * @return 透明化后的图片对象
353      * @throws Exception 
354      */
355     public static BufferedImage imageLucency(String imgPath)throws Exception{
356         BufferedImage targetImage = null;
357         try {
358                         //读取图片   
359             BufferedImage img = ImageIO.read(new FileInputStream(imgPath));
360                         //透明度
361             int alpha = 0;    
362                         //执行透明化
363             executeRGB(img, alpha);
364             targetImage = new BufferedImage(img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_INT_RGB);
365             Graphics2D g = targetImage.createGraphics();
366             g.drawImage(img, 0, 0, null);
367             g.dispose();
368         } catch (Exception e) {
369             throw new RuntimeException("图片透明化执行异常");
370         }
371         return targetImage;
372     }
373     
374     /**
375      * 执行透明化的核心算法
376      * @param img 图片对象
377      * @param alpha   透明度
378      * @throws Exception 
379      */
380     public static  void executeRGB(BufferedImage img, int alpha) throws Exception{
381         int rgb = 0;//RGB值
382                     //x表示BufferedImage的x坐标,y表示BufferedImage的y坐标
383         for(int x=img.getMinX();x<img.getWidth();x++){
384             for(int y=img.getMinY();y<img.getHeight();y++){
385                      //获取点位的RGB值进行比较重新设定
386                 rgb = img.getRGB(x, y); 
387                 int R =(rgb & 0xff0000 ) >> 16 ; 
388                 int G= (rgb & 0xff00 ) >> 8 ; 
389                 int B= (rgb & 0xff ); 
390                 if(((255-R)<30) && ((255-G)<30) && ((255-B)<30)){ 
391                     rgb = ((alpha + 1) << 24) | (rgb & 0x00ffffff); 
392                     img.setRGB(x, y, rgb);
393                 }
394             }
395         }
396     }
397     
398     
399     /**
400      * 图片格式转化操作(文件物理存盘)
401      * @param imgPath    原始图片存放地址
402      * @param format 待转换的格式 jpeg,gif,png,bmp等
403      * @param destPath  目标文件地址
404      * @throws Exception
405      */
406     public static void formatConvert(String imgPath, String format, String destPath)throws Exception{
407         try {
408             BufferedImage bufferedImage = ImageIO.read(new File(imgPath));
409             ImageIO.write(bufferedImage, format, new File(destPath));
410         } catch (IOException e) {
411             throw new RuntimeException("文件格式转换出错");
412         }
413     }
414     
415     /**
416      * 图片格式转化操作返回BufferedImage对象
417      * @param bufferedImage  BufferedImage图片转换对象
418      * @param format  待转换的格式 jpeg,gif,png,bmp等
419      * @param destPath   目标文件地址
420      * @throws Exception
421      */
422     public static void formatConvert(BufferedImage bufferedImag, String format, String destPath)throws Exception{
423         try {
424             ImageIO.write(bufferedImag, format, new File(destPath));
425         } catch (IOException e) {
426             throw new RuntimeException("文件格式转换出错");
427         }
428     }
429     
430     
431     /**
432      * 获取图片文件的真实格式信息
433      * @param imgPath   图片原文件存放地址
434      * @return 图片格式
435      * @throws Exception
436      */
437     public static String imageFormat(String imgPath)throws Exception{
438         String[] filess = imgPath.split("\\\\");
439         String[] formats = filess[filess.length - 1].split("\\.");
440         return formats[formats.length - 1];
441      }
442     
443     /**
444      * For Test By Jason
445      */
446     public static void main(String[] args) {
447         
448     }
449 
450 }

 

转载于:https://www.cnblogs.com/jasonandy/p/9184823.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/465693.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

电子美图更新36张!

电子美图更新36张&#xff0c;下面请欣赏&#xff01;如果喜欢&#xff0c;请帮忙点“赞”和"在看"哦&#xff01;推荐阅读&#xff1a;专辑|Linux文章汇总专辑|程序人生专辑|C语言我的知识小密圈关注公众号&#xff0c;后台回复「1024」获取学习资料网盘链接。欢迎点…

关于培训1

这个笔记其实应该不久前就写了&#xff0c;直到今天早上才有时间来动手。这次培训是关于本地化L10N&#xff0c;和国际化I12N&#xff0c;还有全球化G11N的一次详细介绍。具体来说&#xff0c;是关于UNICODE和一些老的编码的介绍。关于一个字符占有多少个字节&#xff0c;还有字…

Python3——文件与异常

Python3——文件与异常 目录 Python3——文件与异常 文件 &#xff08;1&#xff09;、打开文件open() &#xff08;2&#xff09;、写文件write() &#xff08;3&#xff09;、从文件读取数据 异常&#xff08;防止程序崩溃&#xff09; &#xff08;1&#xff09;、tr…

PHP页面显示中文字符出现乱码

【出现问题】 php页面显示中文字符出现乱码 【解决方法】 在php页面的代码前插入一行代码即可 header("Content-Type: text/html;charsetutf-8"); 转载于:https://www.cnblogs.com/wangyang0210/p/9187403.html

C#多线程JOIN方法初探

[说明&#xff1a;刚接触多线程时&#xff0c;弄不明白Join()的作用&#xff0c;查阅了三本书&#xff0c;都不明不白。后来经过自己的一番试验&#xff0c;终于弄清了Join()的本质。大家看看我这种写法是否易懂&#xff0c;是否真的写出了Join()的本质&#xff0c;多提宝贵意见…

STM32F0单片机快速入门八 聊聊 Coolie DMA

1.苦力 DMA世上本没有路&#xff0c;走的人多了&#xff0c;便成了路。世上本没有 DMA&#xff0c;需要搬运的数据多了&#xff0c;便有了 DMA。大多数同学应该没有在项目中用过这个东西&#xff0c;因为一般情况下也真不需要这个东西。在早期的单片机中也不存在DMA模块。再加上…

Python3——网络编程基础

Python3——网络编程基础 基础知识参考&#xff1a; https://blog.csdn.net/wqx521/article/details/51037048 https://blog.csdn.net/wqx521/article/details/51056649 https://blog.csdn.net/wqx521/article/details/51056713 https://blog.csdn.net/wqx521/article/deta…

Python学习之==第三方模块的安装、模块导入

一、模块&包 1、模块 模块实质上就是一个Python文件&#xff0c;它是用来组织代码的。意思就是把Python代码写在里面&#xff0c;文件名就是模块的名称。例如&#xff1a;random.py&#xff0c;random就是模块的名称。 2、包 包又叫pageage&#xff0c;本质就是一个文件夹&…

【注册机】Zillions of Games v2.0.1p 注册机

下载地址&#xff1a;http://keygens.nl/crack/87061/转载于:https://www.cnblogs.com/boringlamb/archive/2010/02/24/1672404.html

操作系统中抢占式和非抢占式内核的区别

编排 | strongerHuang微信公众号 | 嵌入式专栏操作系统分为抢占式内核和非抢占式内核&#xff0c;通常RTOS都是抢占式内核。下面就来讲讲抢占式内核和非抢占式内核的内容。非抢占式内核非抢占式内核要求每个任务&#xff08;线程&#xff09;都做一些事情来明确放弃对 CPU 的控…

Python3——简单的TCP实例

Python3网络编程——简单的TCP实例 服务器&#xff1a;创建套接字——绑定服务器地址——监听连接——接受连接——数据接收/发送 客户端&#xff1a;创建套接字——连接服务器地址——数据接收/发送 """ server.py encode()/decode() """ fro…

位图索引,数据库索引浅浅的学习

摘自http://www.cnblogs.com/LBSer/p/3322630.html 位图&#xff08;BitMap&#xff09;索引 前段时间听同事分享&#xff0c;偶尔讲起Oracle数据库的位图索引&#xff0c;顿时大感兴趣。说来惭愧&#xff0c;在这之前对位图索引一无所知&#xff0c;因此趁此机会写篇博文介绍下…

UDP协议 sendto 和 recvfrom 浅析与示例

图片/在思考的樱木花道UDP&#xff08;user datagram protocol&#xff09;用户数据报协议&#xff0c;属于传输层。UDP是面向非连接的协议&#xff0c;它不与对方建立连接&#xff0c;而是直接把数据报发给对方。UDP无需建立类如三次握手的连接&#xff0c;使得通信效率很高。…

2010软考软件设计师冲刺精选【专家压轴模拟•下】

2010软考软件设计师冲刺精选【专家压轴模拟•下】 自测简介&#xff1a; 为迎战2010年软考&#xff0c;51CTO特邀请软考专家为网友出了一系列模拟冲刺题。其中包括网络规划设计师、网络工程师、网络管理员、软件设计师、程序员等。本套技术自测是软考软件设计师冲刺模拟题…

劝你要看一些有门槛的机会

最近发了很多招聘信息&#xff0c;招聘的岗位算不错的&#xff0c;但是投简历的人不多。我想起来刚开始工作那几年&#xff0c;工资虽然很低&#xff0c;但是也不怎么想鞠躬投简历&#xff0c;毕竟那个时候把面子这个事情看的比什么都重要。自己觉得自己有才&#xff0c;不过后…

Python3——简单的UDP实例

Python3——简单的UDP实例 服务器&#xff1a;创建套接字——绑定套接字——数据接收/发送 客户端&#xff1a;创建套接字——数据接收/发送 """ server.py encode()/decode() """ from socket import * from time import ctimeHOST PORT 11…

[状压dp]洛谷 P2157 学校食堂

题目描述 小F 的学校在城市的一个偏僻角落&#xff0c;所有学生都只好在学校吃饭。学校有一个食堂&#xff0c;虽然简陋&#xff0c;但食堂大厨总能做出让同学们满意的菜肴。当然&#xff0c;不同的人口味也不一定相同&#xff0c;但每个人的口味都可以用一个非负整数表示。 由…

怎么得到自增列的下一个会插入的id

代码 1declareTable_namevarchar(60) 2setTable_namePay_inputpay; 3Selectso.name Table_name, --表名字4sc.name Iden_Column_name, --自增字段名字5ident_current(so.name) curr_value, --自增字段当前值6ident_incr(so.name) incr_value,…

ESP32,使用gitee搭建 ESP-IDF 开发框架

ESP32便宜&#xff0c;开发方便&#xff0c;非常适合初学者用来学习&#xff0c;之前我自己写的开发环境可能不再适合&#xff0c;推荐下面这篇文章。关于如何搭建ESP32的开发环境&#xff0c;乐鑫官方给出了很详细的教程和文档&#xff0c;基本上跟着官方教程来操作&#xff0…

jQuery的ajax技术

编辑本博客 ajax异步的JavaScript和html load() 从服务器加载数据&#xff0c;并把返回的数据放入备选元素中。这里加载回来的数据可以只有一个p标签&#xff0c;无需head元素等 $("selector").load(url,data,callback) url&#xff1a;必选&#xff0c;规定加载的ur…