Chinaunix首页 | 论坛 | 博客
  • 博客访问: 91149
  • 博文数量: 25
  • 博客积分: 1435
  • 博客等级: 上尉
  • 技术积分: 152
  • 用 户 组: 普通用户
  • 注册时间: 2010-01-09 17:12
个人简介

fsdfas

文章分类

全部博文(25)

文章存档

2014年(1)

2013年(24)

我的朋友

分类: Web开发

2013-03-30 15:00:57

Download required libraries

$ cd ~/download
$ yum install libsndfile-devel unzip
$ wget 
$ wget 
$ wget 
$ wget  

Compile required library for pHash. We need to enable the audio and image support because of the PHP extension.

$ tar xvf libsamplerate-0.1.8.tar.gz
$ cd libsamplerate-0.1.8
$ ./configure
$ make && make install
$
$ tar xvf mpg123-1.15.1
$ cd mpg123-1.15.1
$ ./configure
$ make && make install
We need to copy CImg.h in the /user/local/include folder
$ unzip CImg-1.5.4.zip
$ cp CImg-1.5.4/CImg.h /usr/local/include 

Compile pHash library

$ tar xvf pHash-0.9.5.tar.gz
$ cd pHash-0.9.5
$ ./configure --enable-video-hash=no
$ make && make install
Compile the PHP extension
$ cd bindings/php
$ phpize
$ ./configure LIBS="-lpthread" 

Edit pHash.cpp

I had to edit pHash.cpp to fix a compilation error. I think you only need to do it if you are using php >=5.3

$ vi /root/download/pHash-0.9.5/bindings/php/pHash.cpp
# line 106, replace "function_entry" by "zend_function_entry"
# save and close
Finish the compilation
$ make
$ make test
$ make install
# finally enable pHash in the php.ini adding extension=pHash.so
# restart apache 

Optional - If you want to store the hash in the database (SQL):

You need to edit the pHash.cpp to modify the return value to the hash.

By default ph_dct_imagehash($file) return a *ulong64 (pointer) we need to retrieve a string to store it in the database.

阅读(3090) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~