// $ SrcFile: source file
// $ DstFile: target file
// $ DstW: target image width
// $ DTH: height of the target file
Function makethumb2 ($ srcFile, $ dstFile, $ dstW, $ dsomething ){
$ Data = GetImageSize ($ srcFile, & $ info );
Switch ($ data [2]) {
Case 1:
$ Im = @ ImageCreateFromGIF ($ srcFile );
Break;
Case 2:
$ Im = @ ImageCreateFromJPEG ($ srcFile );
Break;
Case 3:
$ Im = @ ImageCreateFromPNG ($ srcFile );
Break;
}
$ SrcW = ImageSX ($ im );
$ SrcH = ImageSY ($ im );
$ Ni = ImageCreate ($ dstW, $ dsomething );
ImageCopyResized ($ ni, $ im, 0, 0, 0, $ dstW, $ dsomething, $ srcW, $ srcH );
ImageJpeg ($ ni, $ dstFile );
// If you need to output data to the browser, change the previous sentence to ImageJpeg ($ ni );
// If you need images in other formats, you can change the last sentence.
}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.