Phasion is a Ruby wrapper around pHash library, which can be easily used in Ruby on Rails web applications that do a lot of work with multimedia data. Ruby on Rails Phasion plugin is a great tool for RoR developers since it allows to maintain Ruby on Rails project’s database clean and tidy.

More, imagine a situation where you want to protect your users or clients vs not authorized copying their work (for example if your Ruby on Rails application is auction type service like Ebay) from copying your work within your RoR application system or even between similar application available in the market(for this you would need to code some solution in Ruby on Rails for screen scraping / crawling another web sites and comparing their content with protected content stored in your Ruby on Rails application).

Installation procedure is simple:

  1. install pHash and dependency libraries: CImg, ffmpeg and libjpeg.
  2. Download and install the latest pHash tarball from http://phash.org/download/.Remeber to check release notes for latest bug fixes and compatibility issues (to make sure your Ruby on Rails project will take full advantage of a plugin)
  3. Finally, run make && make install to install the pHash binaries.

Sample usage in your Ruby on Rails app:

require 'phashion'
pic1 = Phashion::Image.new(name1)
pic2 = Phashion::Image.new(name2)
pic1.duplicate?(pic2)
--> true

Enjoy!