Hi,
When you retrieve the blob it will treat it as a string of unicode characters. Likewise, when you read in a file, it will read in unicode strings and characters. You can therefore do a simple string comparison with == to see if they are the same.
Here is a simple example. Note that it is may be better to stream the file in using fread to save resource, but it is not too hard to implement that.
PHP Code:
<?php
$conn = mysql_connect('localhost', 'root', 'mypass');
mysql_select_db("testing");
$rs = mysql_query('SELECT img FROM images WHERE id = 2');
$row = mysql_fetch_array($rs);
$image1 = $row['img'];
$image2 = file_get_contents('mypic.gif');
if($image1 == $image2)
echo "SAME!";
else
echo "DIFFERENT!";
?>