WordPress timthumb.php从顶部开始剪切图片

在wordpress主题的开发中,我们常用到一个图片剪切工具timthumb,但是此工具默认是居中剪切,这对于一些长图片(例如PPT模板图片)来说就很不友好了,那么如何能从顶部开始剪切图片呢?

有个参数a,可有如下值

  • c : position in the center (this is the default)
  • t : align top
  • tr : align top right
  • tl : align top left
  • b : align bottom
  • br : align bottom right
  • bl : align bottom left
  • l : align left
  • r : align right

方法如下:

timthumb.php?src=image.jpg&w=100&h=100&a=t