? // Actively scale down the original file $ srcFile, large image; $ photo_small target file, small image; $ dstW, $ dsomething is the width and height of the small image. Functionmakethumb ($ srcFile, $ photo_small, $ dstW, $ dsomething) {$ data = GetImageSize ($ srcFile); switch ($
// Actively scale down the original file $ srcFile, large image; $ photo_small target file, small image; $ dstW, $ dsomething is the width and height of the small image.
Function makethumb ($ srcFile, $ photo_small, $ dstW, $ dsomething ){
$ Data = GetImageSize ($ srcFile );
Switch ($ data [2]) {
Case 1: // image type. 1 is a GIF image.
$ Im = @ ImageCreateFromGIF ($ srcFile );
Break;
Case 2: // image type; 2: JPG
$ Im = @ imagecreatefromjpeg ($ srcFile );
Break;
Case 3: // the image type. 3 is a PNG image.
$ Im = @ ImageCreateFromPNG ($ srcFile );
Break;
}
$ SrcW = ImageSX ($ im); // The width of the original image. you can also apply $ data [0].
$ SrcH = ImageSY ($ im); // The height of the original image. you can also apply $ data [1].
$ SrcX = 0; // coordinates of the Origin chart x, y
$ SrcY = 0;
If ($ srcW/$ dstW)> ($ srcH/$ dsomething) {// Obtain the length and width of a natural image
$ DstW2 = $ dstW; // width and height of the output image
$ DstH2 = $ srcH * $ dstW/$ srcW;
$ DstX = 0; // coordinates of the output image x, y
$ DstY = ($ dsomething-$ dstH2)/2;
}
Else {
$ DstH2 = $ dsomething; // width and height of the output image
$ DstW2 = $ srcW * $ dstW/$ srcH;
$ DstX = ($ dstW-$ dstW2)/2; // output coordinate x, y
$ DstY = 0;
}
$ Ni = imagecreatetruecolor ($ dstW, $ dsomething); // ImageCreate ($ dstW, $ dsomething); draw the size of the blank cloth
$ ColorBody = imagecolorallocate ($ ni, 235,234,233); // defines the background color.
Imagefill ($ ni, $ colorBody); // fill the background color
ImageCopyResized ($ ni, $ im, $ dstX, $ dstY, $ srcX, $ srcY, $ dstW2, $ dstH2, $ srcW, $ srcH );
ImageJpeg ($ ni, $ photo_small );
// ImageJpeg ($ ni); // used to display an image. you can cancel the annotation and display the image directly on the page.
}
// Images with inherent copyright information
Function makeCopyright ($ srcFile, $ dstFile, $ dstW, $ dsomething ){
$ Data = GetImageSize ($ srcFile );
Switch ($ data [2]) {
Case 1: // image type. 1 is a GIF image.
$ SrcImg = @ ImageCreateFromGIF ($ srcFile );
Break;
Case 2: // image type; 2: JPG
$ SrcImg = @ imagecreatefromjpeg ($ srcFile );
Break;
Case 3: // the image type. 3 is a PNG image.
$ SrcImg = @ ImageCreateFromPNG ($ srcFile );
Break;
}
$ SrcW = ImageSX ($ srcImg); // The width of the original image. you can also apply $ data [0].
$ SrcH = ImageSY ($ srcImg); // The height of the original image. you can also apply $ data [1].
If ($ srcW/$ dstW)> ($ srcH/$ dsomething) {// Obtain the length and width of a natural image
$ DstW2 = $ dstW; // width and height of the output image
$ DstH2 = $ srcH * $ dstW/$ srcW;
}
Else {
$ DstH2 = $ dsomething; // width and height of the output image
$ DstW2 = $ srcW * $ dstW/$ srcH;
}
$ Dstimg = imagecreatetruecolor ($ dstW2, $ dstH2); // draw the size of the blank flower cloth
ImageCopyResized ($ dstimg, $ srcImg, 0, 0, 0, $ dstW2, $ dstH2, $ srcW, $ srcH );
// Define the text to be written
$ Word = 'http: // www.webjx.com '; // text
$ Font = 5; // font
$ WordColor = imagecolorallocate ($ dstimg, 0x08,0x00,0x00); // color
$ WordX = $ dstW2-200; // x coordinate