* Basic image processing, used to complete image indentation and watermark addition
* When the watermark image exceeds the target image size, the watermark image can automatically adapt to the target image and shrink
* The watermark image can be set to merge with the background
<?php //JPG格式 require_once('lib/thumb.class.php'); $t = new ThumbHandler(); // 基本使用 $t->setSrcImg("img/test1.jpg"); $t->setDstImg("tmp/new_test1.jpg"); $t->setDstImgBorder(4,"#dddddd"); // 指定缩放比例 $t->createImg(300,200); ?> <?php //GIF格式 require_once('lib/thumb.class.php'); $t = new ThumbHandler(); // 基本使用 $t->setSrcImg("img/test2.gif"); $t->setDstImg("tmp/new_test2.gif"); $t->setDstImgBorder(4,"#dddddd"); // 指定缩放比例 $t->createImg(100,100); ?> <?php //PNG格式 require_once('lib/thumb.class.php'); $t = new ThumbHandler(); // 基本使用 $t->setSrcImg("img/test3.png"); $t->setDstImg("tmp/new_test3.png"); $t->setDstImgBorder(4,"#dddddd"); //指定压缩级别(0~9),重要 $t->setImgDisplayQuality(9); // 指定缩放比例 $t->createImg(50,50); ?> <?php //JPG格式 require_once('lib/thumb.class.php'); $t = new ThumbHandler(); // 基本使用 $t->setSrcImg("img/test1.jpg"); $t->setMaskFontColor("#000000"); //设置文字水印 $t->setMaskWord("test"); //指定水印位置 $t->setMaskPosition(4); $t->setDstImg("tmp/new_test4.jpg"); // 指定缩放比例 $t->createImg(300,280); ?> <?php require_once('lib/thumb.class.php'); $t = new ThumbHandler(); $t->setSrcImg("img/test1.jpg"); // 指定字体文件地址 $t->setMaskFont("fonts/TitilliumMaps29L002.otf"); $t->setMaskFontSize(20); $t->setMaskFontColor("#000000"); $t->setMaskWord("hello world"); //设置水印横向偏移 $t->setMaskOffsetX(50); //设置水印纵向偏移 $t->setMaskOffsetY(55); //设置文字合并程度 $t->setMaskTxtPct(20); //设置缩略图边框 $t->setDstImg("tmp/new_test5.jpg"); $t->setDstImgBorder(10,"#dddddd"); $t->createImg(300,200); ?> <?php // 自动裁切: // 程序会按照图片的尺寸从中部裁切最大的正方形,并按目标尺寸进行缩略 require_once ('lib/thumb.class.php'); $t = new ThumbHandler (); $t->setSrcImg ( "img/test1.jpg" ); $t->setCutType ( 1 ); //这一句就OK了 $t->setDstImg ( "tmp/new_test6.jpg" ); $t->createImg ( 300, 200 ); ?> <?php //手工裁切: // 程序会按照指定的位置从源图上取图 require_once ('lib/thumb.class.php'); $t = new ThumbHandler (); $t->setSrcImg ( "img/test1.jpg" ); $t->setCutType ( 2 ); //指明为手工裁切 $t->setSrcCutPosition ( 100, 100 ); // 源图起点坐标 $t->setRectangleCut ( 300, 200 ); // 裁切尺寸 $t->setDstImg ( "tmp/new_test7.jpg" ); $t->createImg ( 300, 200 ); ?>

The article discusses PHP Data Objects (PDO), an extension for database access in PHP. It highlights PDO's role in enhancing security through prepared statements and its benefits over MySQLi, including database abstraction and better error handling.

Memcache and Memcached are PHP caching systems that speed up web apps by reducing database load. A single instance can be shared among projects with careful key management.

Article discusses steps to create and manage MySQL databases using PHP, focusing on connection, creation, common errors, and security measures.

The article discusses how JavaScript and PHP interact indirectly through HTTP requests due to their different environments. It covers methods for sending data from JavaScript to PHP and highlights security considerations like data validation and prot

The article discusses executing PHP scripts from the command line, including steps, common options, troubleshooting errors, and security considerations.

PEAR is a PHP framework for reusable components, enhancing development with package management, coding standards, and community support.

PHP is a versatile scripting language used mainly for web development, creating dynamic pages, and can also be utilized for command-line scripting, desktop apps, and API development.

The article discusses PHP's evolution from "Personal Home Page Tools" in 1995 to "PHP: Hypertext Preprocessor" in 1998, reflecting its expanded use beyond personal websites.


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

WebStorm Mac version
Useful JavaScript development tools

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.

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SublimeText3 Chinese version
Chinese version, very easy to use

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool
