I am trying to take two images and compare them using ImageMagick.
I want to find out if the images are close to the same and return a number to be stored in a variable in php and displayed in my browser screen.
My hosting account is with bluehost and I have tested by resizing an image and ImageMagick is installed and running. The following code works here: http://zing-cards.com/imagetest2.php
<?php $photo="/home/tcsdesig/public_html/zing/flower.jpg"; $cmd = "/usr/bin/convert $photo -thumbnail 100x100 JPG:-"; header("Content-type: image/jpeg"); passthru($cmd, $retval); ?> I understand the the following command line code (according to this post) is supposed to get the results in a number format:
compare -metric RMSE first.png second.png NULL: Here is my code so far:
<?php $photoPath1="/home/*username*/public_html/flower.jpg"; $photoPath2="/home/*username*/public_html/flower1.jpg"; $cmd = "/usr/bin/compare -metric RMSE $photoPath1 $photoPath2 NULL:"; exec($cmd); ?> How do I make this value show in my browser?
Other than the above code I have tried:
$result = exec($cmd); echo $result; From what I understand this should display a low number (since the images are equal) and if I use completely different images they should display a high number but I don't get any results.