<?php require("PHP_Image_Class.php"); if($_GET["do"]=="Resize_NewFile1"){// 调整图片大小 并 新建图片 并 修改类型 ################## // Create new image and resize original image by specified width $img = new ImageTools("images/flower.jpg"); $img->resizeNewByWidth(200,200,215,"#CCC"); // new width, new height, new resize width, bg color $img->setOutputType(ImageTools::IMAGE_TYPE_PNG); // output result image as PNG $img->showImage(); $img->destroy(); } if($_GET["do"]=="Resize_NewFile2"){// 调整图片大小 并 新建图片 并 修改类型 ################## // Create new image and resize original image by specified height $img = new ImageTools("images/flower.jpg"); $img->resizeNewByHeight(100,100,215,"#CCC"); // new width, new height, new resize height, bg color $img->setOutputType(ImageTools::IMAGE_TYPE_PNG); // output result image as PNG $img->showImage(); $img->destroy(); } if($_GET["do"]=="Resize_NewFile3"){// 调整图片大小 并 新建图片 并 修改类型 ################## // Create new image and resize original image by specified height $img = new ImageTools("images/flower.jpg"); $img->resizeNewByHeight(300,300,150,"#CCC"); // new width, new height, new resize height, bg color $img->setOutputType(ImageTools::IMAGE_TYPE_PNG); // output result image as PNG $img->showImage(); $img->destroy(); } ?>
用于处理图片的PHP类,可在图片上提供这些操作:
用法很简单,不需要插件,4-5行代码就能实现一个复杂的功能。 从而为PHP开发人员节约大量的开发时间。
而且安装简单,只需要把文件上传到服务器修改一下路径即可完成。