Hello,
I created a small script which first copy an image, strip the Exif Data from an Image and rewrite it and then generate a regular md5_hash from it.
Well, this little script gives the same hash on almost every file. There's just one file, which returns a new random hash every time, and I simply can't find the reason why.
Here's the code:
While the Skin3WithTrash.png returns the same hash, it varies for Skin2WithTrash.png every time.
The simple question is: Why? And how can I solved this..
All files for needed to test it are attachted.
View attachment HashProblem.zip
Thx for every hint and happy Easter!
I created a small script which first copy an image, strip the Exif Data from an Image and rewrite it and then generate a regular md5_hash from it.
Well, this little script gives the same hash on almost every file. There's just one file, which returns a new random hash every time, and I simply can't find the reason why.
Here's the code:
Code:
<?php
// Copy due to trim process!
$imagePath = "Test.png";
copy('Skin2WithTrash.png', $imagePath);
// copy('Skin3WithTrash.png', $imagePath);
# Reduce image
$image = new Imagick(dirname(__FILE__) . '/' . $imagePath);
$image->stripImage();
$image->writeImage(dirname(__FILE__) . '/' . $imagePath);
$image->destroy();
# Return hash
var_dump(md5_file($imagePath));
unlink($imagePath);
While the Skin3WithTrash.png returns the same hash, it varies for Skin2WithTrash.png every time.
The simple question is: Why? And how can I solved this..
All files for needed to test it are attachted.
View attachment HashProblem.zip
Thx for every hint and happy Easter!