Timthumb is a very concise and easy to use in the layout of the PHP program, as long as you set some parameters, it can generate thumbnails. Now many WordPress theme, use Timthumb this PHP class library for thumbnail image processing. This article mainly introduces PHP using Timthumb to generate thumbnails of the method, the example analysis of PHP call Timthumb generated thumbnail operation skills and related considerations, the need for friends can refer to, specific as follows:
There are two ways to generate a indented graph:
First, the early generation of good, for the call
The general practice is to start based on the image specifications in the site, how many kinds of indented graph to generate, the image upload process will generate indentation, for different needs to call. A little bit like this method is, if you add the image specifications, the previously uploaded pictures do not have the specifications, but also to regenerate.
second, when the call is generated in the indented graph . That's why I'm writing this article.
Recommend a timthumb, personally feel that in the case of performance, efficiency, this thing, is absolutely easy to use.
1, download Address: http://timthumb.googlecode.com/svn/trunk/timthumb.php
2, how to use
After downloading, put in your web environment, in a directory parallel to the timthumb.php to build a cache folder, give 755 permissions, Windows, it is not. The test code is as follows:
<?php$image = "Http://localhost/test/pen_pic03.png";? >
Parameter description:
W=58 indicates a picture width of 58
H=46 indicates a picture height of 46
Can be set casually as needed.
Timthumb The biggest advantage is the convenience, has not encountered such a tool, the shortcomings are equally obvious, each time the request, will call php-cgi or PHP-CLI, the cached data in the cache directory, call data to find the directory, the performance will be relatively low.