PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Ming Choi   Images Comparison Class   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: example
Class: Images Comparison Class
Compare two images to check if they are identical
Author: By
Last change: png
Date: 14 years ago
Size: 816 bytes
 

Contents

Class file image Download
<?php
//ImagesComparison Class Example
require "ImagesComparison.class.php";

//two images with exactly same width and height
$compare = new ImagesComparison("a.png", "b.png");

//compare two images(can skip)
$compare->compare();

//give each part of contiguous difference a number(can skip)
$compare->index();

//check the consistency of two images
//var_dump($compare->consistency()); //(it will send a header, so skip it because of printImage)

//fill in the difference with certain color: array(red, green, blue), else, random color for each contiguous part
$compare->fillDiff();

//circle the difference with certain color: array(red, green, blue), else, red; offset => make the circle bigger
$compare->circleDiff();

//print the image to the browser or a file
$compare->printImage();
?>