PHP dynamically generate thumbnails and output the method of display, PHP dynamically generate thumbnails _php tutorial

Source: Internet
Author: User

PHP dynamically generated thumbnails and output the method of display, PHP dynamically generated thumbnail image


The examples in this article describe how PHP dynamically generates thumbnails and outputs the display. Share to everyone for your reference. Specific as follows:

Call Method:

This code can dynamically generate thumbnail display for large images, images generated in memory, not hard disk to generate real files

The thumbs.php file is as follows:

<?php$filename= $_get[' filename '; $width = $_get[' width '); $height = $_get[' height ']; $path = "http://localhost/images/"; Finish in "/"//Content Typeheader (' content-type:image/jpeg ');//Get new Dimensionslist ($width _orig, $height _orig) = g Etimagesize ($path. $filename), if ($width && ($width _orig < $height _orig)) {  $width = ($height/$height _ ORIG) * $width _orig;} else {  $height = ($width/$width _orig) * $height _orig;} Resample$image_p = Imagecreatetruecolor ($width, $height); $image = Imagecreatefromjpeg ($path. $filename); Imagecopyresampled ($image _p, $image, 0,0,0,0, $width, $height, $width _orig, $height _orig);//Outputimagejpeg ($image _p , null, +);//Imagedestroyimagedestroy ($image _p);? >

I hope this article is helpful to everyone's PHP programming.

http://www.bkjia.com/PHPjc/987255.html www.bkjia.com true http://www.bkjia.com/PHPjc/987255.html techarticle PHP dynamically generated thumbnails and output the method of display, PHP dynamic generation of thumbnails in this article, we describe the dynamic generation of PHP thumbnails and output display methods. Share to everyone for your reference. ...

  • Related Article

    Contact Us

    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.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.