Php uses timthumb to generate thumbnails

Source: Internet
Author: User
: This article describes how to use timthumb to generate thumbnails in php. if you are interested in the PHP Tutorial, refer to it. This example describes how to use timthumb to generate thumbnails in php. We will share this with you for your reference. The details are as follows:

There are two ways to generate a column chart:

1. generate the information in advance for calling

The common practice of column chart shrinking is to start generating the number of types of column charts based on the image types on the website. during The Image uploading process, the column shrinking is generated for different requests. If the image type is not added, the previously uploaded image must be regenerated.

II. generate a column chart during the call. This is why I wrote this article.

I recommend a timthumb. I personally think this is definitely useful without considering performance and efficiency.

1,: http://timthumb.googlecode.com/svn/trunk/timthumb.php

2. usage

After downloading the file, place it in your web environment and create a cache folder in the directory parallel to timthumb. php. Grant the 755 permission. if it is windows, you will not need to use it. The test code is as follows:

<? Php $ image = "http: // localhost/test/pen_pic03.png";?>Timthumb& W = 58 & h = 46 & zc = 1 "alt =" php uses timthumb to generate thumbnails "/>

Parameter description:

W = 58 indicates that the image width is 58.
H = 46 indicates that the image height is 46.

You can set it as needed.

The greatest advantage of timthumb is its convenience. At present, we have never encountered such a tool. The disadvantage is also obvious. every time a request is made, we call php-cgi or php-cli, the cached data is stored in the cache directory, and the called data needs to be searched for the directory, which results in low performance.

I hope this article will help you with PHP programming.

The above describes how to use timthumb to generate thumbnails in php, including some content. if you are interested in the PHP Tutorial.

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.