Is it possible to use md5 checksum for images that have slight modifications?

When images have slight modifications, their md5 checksums will be different even if the visual differences are minimal. To solve this issue, you can use a more robust hashing algorithm like SHA-256 which will provide a unique checksum for each image regardless of slight modifications.

// Function to calculate SHA-256 checksum for an image file
function calculateChecksum($imagePath) {
    return hash_file('sha256', $imagePath);
}

// Example of how to use the function
$imagePath = 'path/to/image.jpg';
$checksum = calculateChecksum($imagePath);
echo "SHA-256 checksum for image: $checksum";