欧美不卡视频中文字幕

Join VIP [check in and send gold coins]
Dream weaving worry free, heart to do source code! 7 years of brand, trustworthy! Dream weaving without worry, each fine product, rather than excessive! Purchase no less than 3000 yuan per month, free source sharing, open early, enjoy early! Temporary promotion for lifelong members, only 128 yuan! The new member opens, enters the member center directly -- the purchase member -- opens directly.

Original dedecms thumbnail series tutorial: solve the problem of dedecms thumbnail scaling deformation

Abstract: Background: the principle of dedecms generating thumbnail is not flexible enough, which leads to the distortion of the thumbnail. For example, the size of the thumbnail set in the background is 120 * 90, that is, 3:2 picture. However, if the size of the large picture in the content is 300 * 300, that is 1:1, the generated image will be deformed, which seriously affects the beauty of the website. This paper introduces the method of generating abbreviated source code by modifying dedecms
Article introduction

Background: the principle of dedecms to generate thumbnails is not flexible enough, which leads to the distortion of the thumbnail. For example, the size of the thumbnail set in the background is 120 * 90, that is, the 3:2 picture. However, if the size of the large picture in the content is 300 * 300, that is, 1:1, the generated image will be deformed and seriously affect the beauty of the website. This paper introduces the method of generating abbreviated source code by modifying dedecms to solve the problem

Open the "include / image. Func. PHP" file in dedecms5 6 and 5.7 are located in different directories. The files in 5.6 are under / include /, and the files in 5.7 are in / include / helpers /. If you are lazy, you can directly search the root directory of the website for image func. PHP file

If you use dedecms 5 7. Open the directory / include / helpers / to find image helper. PHP file

If you use dedecms 5 6. Open the directory / include / to find image func. PHP file

Version 5.7 image helper. PHP modification method

replace

/**

* automatic generation function of zoomed image, source support BMP, GIF, JPG, PNG

* but the generated small image only uses JPG or PNG format

?*

?* @access ? ?public

* @ param string $srcfile image path

* @ param string $towwidth converted to

* @ param string $Toh converted to height

* @ param string $tofile output file to

?* @return ? ?string

?*/

to

/**

* get the version of GD

?*

?* @access ? ?public

?* @return ? ?int

?*/

The middle code is:

?
 001 if ( ! function_exists('ImageResize')) 002 { 003 function ImageResize($srcFile,$toW,$toH,$toFile="") 004 { 005 global $cfg_ photo_ type; 006 if($toFile=="") 007 { 008 $toFile = $srcFile; 009 } 010 $info = ""; 011 $srcInfo = GetImageSize($srcFile,$info); 012 switch ($srcInfo[2]) 013 { 014 case 1: 015 if(!$cfg_photo_type['gif']) 016 { 017 return false; 018 } 019 $im = imagecreatefromgif($srcFile); 020 break; 021 case 2: 022 if(!$cfg_photo_type['jpeg']) 023 { 024 return false; 025 } 026 $im = imagecreatefromjpeg($srcFile); 027 break; 028 case 3: 029 if(!$cfg_photo_type['png']) 030 { 031 return false; 032 } 033 $im = imagecreatefrompng($srcFile); 034 break; 035 case 6: 036 if(!$cfg_photo_type['bmp']) 037 { 038 return false; 039 } 040 $im = imagecreatefromwbmp($srcFile); 041 break; 042 } 043 $srcW=ImageSX($im); 044 $srcH=ImageSY($im); 045 if($srcW<=$toW && $srcH<=$toH ) 046 { 047 return true; 048 } 049 //Abbreviate and crop 050 $newW = $toH * $srcW / $srcH; 051 $newH = $toW * $srcH / $srcW; 052 if($newH >= $toH) 053 { 054 $ftoW = $toW; 055 $ftoH = $newH; 056 } 057 else 058 { 059 $ftoW = $newW; 060 $ftoH = $toH; 061 } 062 if($srcW>$toW||$srcH>$toH) 063 { 064 if(function_exists("imagecreatetruecolor")) 065 { 066 @$ni = imagecreatetruecolor($ftoW,$ftoH); 067 if($ni) 068 { 069 imagecopyresampled($ni,$im,0,0,0,0,$ftoW,$ftoH,$srcW,$srcH); 070 } 071 else 072 { 073 $ni=imagecreate($ftoW,$ftoH); 074 imagecopyresized($ni,$im,0,0,0,0,$ftoW,$ftoH,$srcW,$srcH); 075 } 076 } 077 else 078 { 079 $ni=imagecreate($ftoW,$ftoH); 080 imagecopyresized($ni,$im,0,0,0,0,$ftoW,$ftoH,$srcW,$srcH); 081 } 082 //Crop image into standard thumbnail 083 $new_ imgx = imagecreatetruecolor($toW,$toH); 084 if($newH >= $toH) 085 { 086 imagecopyresampled($new_imgx,$ni,0,0,0,($newH - $toH)/2,$toW,$toH,$toW,$toH); 087 } 088 else 089 { 090 imagecopyresampled($new_imgx,$ni,0,0,($newW - $toW)/2,0,$toW,$toH,$toW,$toH); 091 } 092 switch ($srcInfo[2]) 093 { 094 case 1: 095 imagegif($new_imgx,$toFile); 096 break; 097 case 2: 098 imagejpeg($new_imgx,$toFile,85); 099 break; one hundred case 3: one hundred and one imagepng($new_imgx,$toFile); one hundred and two break; one hundred and three case 6: one hundred and four imagebmp($new_imgx,$toFile); one hundred and five break; one hundred and six default: one hundred and seven return false; one hundred and eight } one hundred and nine imagedestroy($new_imgx); one hundred and ten imagedestroy($ni); one hundred and eleven } one hundred and twelve imagedestroy($im); one hundred and thirteen return true; one hundred and fourteen } one hundred and fifteen }

Save the file after modification, and add a picture of the article to try, if you don't want to modify, you can directly

Version 5.6 image func. PHP modification method

replace

//Automatic generation function of shrink image, source support BMP, GIF, JPG, PNG

to

//Get the version of GD

The middle code is:

?
 001 function ImageResize($srcFile,$toW,$toH,$toFile="") 002 { 003 global $cfg_ photo_ type; 004 if($toFile=="") 005 { 006 $toFile = $srcFile; 007 } 008 $info = ""; 009 $srcInfo = GetImageSize($srcFile,$info); 010 switch ($srcInfo[2]) 011 { 012 case 1: 013 if(!$cfg_photo_type['gif']) 014 { 015 return false; 016 } 017 $im = imagecreatefromgif($srcFile); 018 break; 019 case 2: 020 if(!$cfg_photo_type['jpeg']) 021 { 022 return false; 023 } 024 $im = imagecreatefromjpeg($srcFile); 025 break; 026 case 3: 027 if(!$cfg_photo_type['png']) 028 { 029 return false; 030 } 031 $im = imagecreatefrompng($srcFile); 032 break; 033 case 6: 034 if(!$cfg_photo_type['bmp']) 035 { 036 return false; 037 } 038 $im = imagecreatefromwbmp($srcFile); 039 break; 040 } 041 $srcW=ImageSX($im); 042 $srcH=ImageSY($im); 043 if($srcW<=$toW && $srcH<=$toH ) 044 { 045 return true; 046 } 047 //Abbreviate and crop 048 $newW = $toH * $srcW / $srcH; 049 $newH = $toW * $srcH / $srcW; 050 if($newH >= $toH) 051 { 052 $ftoW = $toW; 053 $ftoH = $newH; 054 } 055 else 056 { 057 $ftoW = $newW; 058 $ftoH = $toH; 059 } 060 if($srcW>$toW||$srcH>$toH) 061 { 062 if(function_exists("imagecreatetruecolor")) 063 { 064 @$ni = imagecreatetruecolor($ftoW,$ftoH); 065 if($ni) 066 { 067 imagecopyresampled($ni,$im,0,0,0,0,$ftoW,$ftoH,$srcW,$srcH); 068 } 069 else 070 { 071 $ni=imagecreate($ftoW,$ftoH); 072 imagecopyresized($ni,$im,0,0,0,0,$ftoW,$ftoH,$srcW,$srcH); 073 } 074 } 075 else 076 { 077 $ni=imagecreate($ftoW,$ftoH); 078 imagecopyresized($ni,$im,0,0,0,0,$ftoW,$ftoH,$srcW,$srcH); 079 } 080 //Crop image into standard thumbnail 081 $new_ imgx = imagecreatetruecolor($toW,$toH); 082 if($newH >= $toH) 083 { 084 imagecopyresampled($new_imgx,$ni,0,0,0,($newH - $toH)/2,$toW,$toH,$toW,$toH); 085 } 086 else 087 { 088 imagecopyresampled($new_imgx,$ni,0,0,($newW - $toW)/2,0,$toW,$toH,$toW,$toH); 089 } 090 switch ($srcInfo[2]) 091 { 092 case 1: 093 imagegif($new_imgx,$toFile); 094 break; 095 case 2: 096 imagejpeg($new_imgx,$toFile,85); 097 break; 098 case 3: 099 imagepng($new_imgx,$toFile); one hundred break; one hundred and one case 6: one hundred and two imagebmp($new_imgx,$toFile); one hundred and three break; one hundred and four default: one hundred and five return false; one hundred and six } one hundred and seven imagedestroy($new_imgx); one hundred and eight imagedestroy($ni); one hundred and nine } one hundred and ten imagedestroy($im); one hundred and eleven return true; one hundred and twelve }

Can be directly

Due to the different versions of dedecms code is different, if there is a problem, you can find with the version network to help solve

Last article:

Next:

Link to this article: http://b5y7hj.cn//dedecmsjiaocheng/anzhuangshiyong/183769.html

Copyright notice: Our resources are from the Internet or member release, if you infringe on your rights and interests, please contact us, we will delete within 24 hours! thank you!

 QR code of public number

Wechat public account

//Auto push

欧美不卡视频中文字幕_我和闺蜜共做一个男人_正撅着她肥白的大屁股

http://25.b5y7hj.cn http://45.b5y7hj.cn http://03.b5y7hj.cn http://96.b5y7hj.cn http://21.b5y7hj.cn http://45.b5y7hj.cn http://32.b5y7hj.cn http://40.b5y7hj.cn http://13.b5y7hj.cn http://77.b5y7hj.cn http://77.b5y7hj.cn