Applogies for repost. For some reason the second half of my message
got chopped off... here's the full this agin (hopefully!)
I'm having a problem with the strstr function that is driving me up
the ?!**!?! wall!
OK, I hope the following sample code will illustrate the problem.
<?
$exif = read_exif_data_raw($HTTP_POST_FILES['image']['tmp_name'],0);
echo '<hr><b>Example 1</b><br>This is the test using fields from the
exif data<hr>';
$make=$exif['IFD0']['Make'];
$model=$exif['IFD0']['Model'];
echo "$make<br>";
echo "$model<br><br>";
if(stristr($model,$make))
{
echo "true<br><br>";
}
else
{
echo "false<br><br>";
}
echo '<hr><b>Example 2</b><br>This is the test using manual data<hr>';
$make="Canon";
$model="Canon EOS300D DIGITAL";
echo "$make<br>";
echo "$model<br><br>";
if(stristr($model,$make))
{
echo "true<br><br>";
}
else
{
echo "false<br><br>";
}
?>
And here is the out put:
Example 1
This is the test using fields from the exif data
Canon
Canon EOS 300D DIGITAL
false
Example 2
This is the test using manual data
Canon
Canon EOS300D DIGITAL
true
This is some code called by a form that uploads an image. In the first
example I am reading in two variables from the EXIF data using a
function from http://www.offsky.com/software/exif/index.php. I am then
comparing the contents of the two fields. the first field contains
"Canon" (in the variable $make) and the second contains "Canon EOS300D
DIGITAL" (in the variable $model). But for some reason it returns
false. In the second example I am entering exactly the same data into
the $make and $model variables manually. This time true is return as
expected. The echo statements confirm that the $make and $model
variable contain the same data in both examples. Can anyone offer an
explanation/solution and save my sanity??
Thanks in advance, Chris