Imagecolorsforindex ()
- Imagecolorat ()
- Draw a graphic on the picture $img =imagecreatefromgif ("./images/map.gif");
/**
- * Image Sharpening Processing
- * Edit by Bbs.it-home.org
- */
- $red = Imagecolorallocate ($img, 255, 0, 0);
Imageline ($img, 0, 0, +, +, $red);
- Imageellipse ($img, $, $red);
- Imagegif ($img, "./images/map2.gif");
- Imagedestroy ($IMG);
Copy CodePicture Normal Zoom
- function Thumn ($background, $width, $height, $newfile) {
- List ($s _w, $s _h) =getimagesize ($background);//Get original picture height, width
- if ($width && ($s _w < $s _h)) {
- $width = ($height/$s _h) * $s _w;
- } else {
- $height = ($width/$s _w) * $s _h;
- }
- $new =imagecreatetruecolor ($width, $height);
- $img =imagecreatefromjpeg ($background);
- Imagecopyresampled ($new, $img, 0, 0, 0, 0, $width, $height, $s _w, $s _h);
- Imagejpeg ($new, $newfile);
- Imagedestroy ($new);
- Imagedestroy ($IMG);
- }
- Thumn ("Images/hee.jpg", "A./images/hee3.jpg");
Copy CodeGIF Transparent Color processing
/**
- * Picture Clipping processing
- * Edit by Bbs.it-home.org
- */
function Cut ($background, $cut _x, $cut _y, $cut _width, $cut _height, $location) {
- $back =imagecreatefromjpeg ($background);
- $new =imagecreatetruecolor ($cut _width, $cut _height);
- Imagecopyresampled ($new, $back, 0, 0, $cut _x, $cut _y, $cut _width, $cut _height, $cut _width, $cut _height);
- Imagejpeg ($new, $location);
- Imagedestroy ($new);
- Imagedestroy ($back);
- }
- Cut ("./images/hee.jpg", the 117, the "./images/hee5.jpg");
- ?>
Copy Codeimage watermark and watermark text
/**
- *
- * Image Add text watermark
- */
function Mark_text ($background, $text, $x, $y) {
- $back =imagecreatefromjpeg ($background);
- $color =imagecolorallocate ($back, 0, 255, 0);
- Imagettftext ($back, 0, $x, $y, $color, "Simkai.ttf", $text);
- Imagejpeg ($back, "./images/hee7.jpg");
- Imagedestroy ($back);
- }
- Mark_text ("./images/hee.jpg", "elaborating PHP", 150, 250);
- Image watermark
- function Mark_pic ($background, $waterpic, $x, $y) {
- $back =imagecreatefromjpeg ($background);
- $water =imagecreatefromgif ($waterpic);
- $w _w=imagesx ($water);
- $w _h=imagesy ($water);
- Imagecopy ($back, $water, $x, $y, 0, 0, $w _w, $w _h);
- Imagejpeg ($back, "./images/hee8.jpg");
- Imagedestroy ($back);
- Imagedestroy ($water);
- }
- Mark_pic ("./images/hee.jpg", "./images/gaolf.gif", 50, 200);
Copy CodePicture Rotation
/**
- * Picture rotation
- * Edit by Bbs.it-home.org
- */
- $back =imagecreatefromjpeg ("./images/hee.jpg");
$new =imagerotate ($back, 45, 0);
- Imagejpeg ($new, "./images/hee9.jpg");
- ?>
Copy CodePicture Horizontal Flip Vertical Flip
/**
- * Picture Horizontal Flip Vertical Flip
- * Edit by Bbs.it-home.org
- */
- function turn_y ($background, $newfile) {
$back =imagecreatefromjpeg ($background);
- $width =imagesx ($back);
- $height =imagesy ($back);
- $new =imagecreatetruecolor ($width, $height);
- for ($x =0; $x < $width; $x + +) {
- Imagecopy ($new, $back, $width-$x-1, 0, $x, 0, 1, $height);
- }
- Imagejpeg ($new, $newfile);
- Imagedestroy ($back);
- Imagedestroy ($new);
- }
- function turn_x ($background, $newfile) {
- $back =imagecreatefromjpeg ($background);
- $width =imagesx ($back);
- $height =imagesy ($back);
- $new =imagecreatetruecolor ($width, $height);
- for ($y =0; $y < $height; $y + +) {
- Imagecopy ($new, $back, 0, $height-$y-1, 0, $y, $width, 1);
- }
- Imagejpeg ($new, $newfile);
- Imagedestroy ($back);
- Imagedestroy ($new);
- }
- Turn_y ("./images/hee.jpg", "./images/hee11.jpg");
- Turn_x ("./images/hee.jpg", "./images/hee12.jpg");
- ?>
Copy Code |