php图像处理常用函数与实例
简单的生成验证码图片代码
header("Content-type: image/jpeg");
// 载入图像
$imagen1 = imagecreatefromjpeg("imagen1.jpg");
$imagen2 = imagecreatefromjpeg("imagen2.jpg");// 复制图像www.bKjia.c0m
imagecopy($imagen1,$imagen2,0,0,0,0,200,150);// 输出jpeg图像
imagejpeg($imagen1);//释放内存
imagedestroy($imagen2);
imagedestroy($imagen1);?>
获取图片属性代码
$info = getimagesize("imagen2.jpg");
print_r($info);?>
生成png图片的php代码
//PNG格式图像处理函数
function Loadpng ($imgname) {
$im = @ImageCreateFromPNG ($imgname);
if (!$im) { //载入图像失败
$im = ImageCreate (400, 30);
$bgc = ImageColorAllocate ($im, 255, 255, 255);
$tc = ImageColorAllocate ($im, 0, 0, 0);
ImageFilledRectangle ($im, 0, 0, 150, 30, $bgc);
ImageString($im, 4, 5, 5, "Error loading: $imgname", $tc);
}
return $im;
}
$imgPng=Loadpng("./karte.png");
/* 输出图像到浏览器 */
header("Content-type: image/png");
imagePng($imgPng);
?>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Atom editor mac version download
The most popular open source editor

SublimeText3 Mac version
God-level code editing software (SublimeText3)

SublimeText3 Chinese version
Chinese version, very easy to use
