The WordPress post thumbnails functionality has become a basic necessity of theme coding, but it does have its limitations. Mainly you are stuck with the image sizes you specify in the Settings – Media tab. You can also specify your own image sizes, but clients undoubtedly want to change their image sizes over time or within one website over and over and over and over…. So it makes sense to make use of the dynamic image resizing script TimThumb. I use the following technique to grab the designated featured image post thumbnail from a post and then automatically resize it upon display. Works perfectly!
优化timthumb.php
TimThumb是一个简洁高效的创建图片缩略图的程序。它功能非常强大,并且制定性很强。通过对多个参数的控制,你可以灵活地设置缩略图片的输出样式。
然而,有时候具体应用时,会产生一些性能问题。由于它的调用方式
<IMG alt="" src="/scripts/timthumb.php?src=/images/whatever.jpg&h=150&w=150&zc=1">
服务器可能不会自动对图片进行压缩,也不会自动添加图片的客户端缓存过期时间。下面我们来看一下如何解决这些问题。