If you want to change it, check this Code (not tested): functionmakeThumb ($ srcFile, $ dstFile, $ dstW, $ dsomething) {$ dataGetImageSize ($ srcFile, $ info ); switch (CoreUtil: getFileExtension ($ dstFile) {casegif: $ im @ ImageCreateFromGIF
If you want to change it, check out this Code (not tested): function makeThumb ($ srcFile, $ dstFile, $ dstW, $ dsomething) {$ data = GetImageSize ($ srcFile, $ info); switch (CoreUtil: getFileExtension ($ dstFile) {case 'gif': $ im = @ ImageCreateFromGIF
If you want to change the code, check the Code (not tested ):
Function makeThumb ($ srcFile, $ dstFile, $ dstW, $ dsomething ){
$ Data = GetImageSize ($ srcFile, & $ info );
Switch (CoreUtil: getFileExtension ($ dstFile )){
Case 'gif ':
$ Im = @ ImageCreateFromGIF ($ srcFile); break;
Case 'jpg ':
Case 'jpeg ':
$ Im = @ imagecreatefromjpeg ($ srcFile); break;
Case 'png ':
$ Im = @ ImageCreateFromPNG ($ srcFile); break;
Default: returnFalse;
}
If (! $ Im) returnFalse;
$ SrcW = ImageSX ($ im );
$ SrcH = ImageSY ($ im );
$ DstX = 0;
$ DstY = 0;
If ($ srcW * $ DTH> $ srcH * $ dstW ){
$ Fd…… = round ($ srcH * $ dstW/$ srcW );
$ DstY = floor ($ DTH-$ fdth)/2); $ fdstW = $ dstW;
} Else {
$ FdstW = round ($ srcW * $ dsomething/$ srcH); $ dstX = floor ($ dstW-$ fdstW)/2 );
$ Fdth = $ DTH;
}
$ Ni = ImageCreate ($ dstW, $ dsomething );
$ DstX = ($ dstX <0 )? 0: $ dstX;
$ DstY = ($ dstX <0 )? 0: $ dstY;
$ DstX = ($ dstX> ($ dstW/2 ))? Floor ($ dstW/2): $ dstX;
$ DstY = ($ dstY> ($ dsomething/2 ))? Floor ($ dsomething/s): $ dstY;
$ Black = ImageColorAllocate ($ ni, 0, 0 );
Imagefilledrectangle ($ ni, 0, 0, $ dstW, $ DTH, $ black );
ImageCopyResized ($ ni, $ im, $ dstX, $ dstY, 0,0, $ fdstW, $ fdsomething, $ srcW, $ srcH );
ImageJpeg ($ ni, $ dstFile );
Imagedestroy ($ im );
Imagedestroy ($ ni );
ReturnTrue;
}
Imagecreatefromjpeg, imagecreatetruecolor, imagecopyresampled, and imagepng functions are used.