PHP thumbnail image function code according to maximum width and height

WBOY
Release: 2016-07-25 08:51:08
Original
984 people have browsed it
A very simple code to shrink images according to the maximum width and height, which is convenient for novices and people who are too lazy to write it themselves
                 
                                                                                                                                                                                                                                                                                                                   OnFunction Thumb ($ ImageFile, $ maxwidth, $ maxheight) {
$ DIM = GetimageSize ($ ImageFile);
$ width = $ dim [0]; = $ dim [1 ; // Original image aspect ratio
                                                                                                                                                                                                        aspect ratio,        aspect ratio
              $thumbHeight = $maxheight;
                                                                                                                                                                        $thumbHeight = $maxheight; = $maxheight*$crown;
            }
  1.                                                                                                                          $thumb thumbHeight, $width, $ height);
  2.                 return $thumb;
  3. }
  4. Copy code
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template