Similair to this question here: php md5_file function with gif file? but the answer doesn't cut it for my situation.
On certain images I apply a md5_file
to, there are a few (out of 20000) that give 2 different results on a random basis.
Example code:
<?php
$moo = 'http://a1100.phobos.apple.com/us/r1000/069/Purple/v4/03/0f/cd/030fcd97-3958-5a96-f1ae-86e55382c529/mzl.lepmgpwz.350x350-75.jpg';
echo md5_file($moo);
?>
Results in either: 673ec8b2f87df0b41ebc17bba85edd9a OR: 235bf518387d59b13a7c820abe73d5eb
I tried to play around with md5(file_get_contents($moo));
and similair versions of sha1
, and sha256
, but the ones I tried all come up with 2 different results on a random basis.
My quick echo test notepad:
<?php
$moo = 'http://a1100.phobos.apple.com/us/r1000/069/Purple/v4/03/0f/cd/030fcd97-3958-5a96-f1ae-86e55382c529/mzl.lepmgpwz.350x350-75.jpg';
echo $moo.'<br /><br />';
echo '- '.md5(file_get_contents($moo)).'<br />';
echo '- '.md5_file($moo).'<br />';
echo '- '.md5($moo).'<br />';
echo '- '.sha1(file_get_contents($moo)).'<br />';
echo '- '.sha1_file($moo).'<br />';
echo '- '.sha1($moo).'<br/>';
?>
Is this common and is there any way to avoid this?
Right now I'm stuck with a few dead images since 1 function places md5_file('my_image');
in my dB with a different name than the resize function saved md5_file('my_image);
as.