webthumb 并没有真正 release,暂时还需要通过 websvn 界面访问。Debian 系统下安装:
并没有想象的顺利,出了一点小错误,#aptitude install mozilla-dev libgtk2.0-dev libglib2.0-dev libxml2-dev xvfb
$cd pageprint/src/
$make install
OK,google 一把,貌似是 gcc4.1 兼容问题,换 gcc-4.0,一样的错误,修改 HttpObserver.h 18 行为:HttpObserver.h:18: error: extra qualification 'HttpObserver::' on member 'SetupToModifyHeaders
//void HttpObserver::SetupToModifyHeaders(); void SetupToModifyHeaders();make 顺利通过,跑一把试试:
#cp PagePrint.xml /etc $./PagePrint -s http://localost/ webthumb.jpg Url: localost, Output: webthumb.jpg Starting PagePrint (PagePrint-bin:6239): Gtk-WARNING **: cannot open display:看来需要先起动模拟的 display:
$./scripts/runXvfb $ ./PagePrint -s http://localost/ webthumb.jpg Url: localost, Output: webthumb.jpg Starting PagePrint Xlib: connection to ":10.0" refused by server Xlib: No protocol specified (PagePrint-bin:6261): Gtk-WARNING **: cannot open display: $模拟的 Xserver,client 连接未获得授权。
$ randomkey=`date +"%y%m%d%H%M%S"` $xauth add ${HOST}:10 . $randomkey $./PagePrint -s http://goodjobs.cn/ goodjobs .... Attempting to Snapshot Webpage Successfully wrote snapshot: goodjobs-thumb_small.jpg Successfully wrote snapshot: goodjobs-thumb_medium.jpg Successfully wrote snapshot: goodjobs-thumb_medium2.jpg Successfully wrote snapshot: goodjobs-thumb_large.jpggreat, it works! 自动生成了不同大小的四份图片,看看 medium2 的实际效果。