I have 1 image (source) stored in one server (this server is only an data server without php or anything), using gd I create another image in a php server with the source as base for creation, so I have one generated image and one source file, for performance I create some kind of a “cache” script thats make a copy of my generated image in my php server, the question is how I can compare if the source image have been update to update my cache? (without using a database, just files treatment, and I need speed and low bandwidth use)
the “cache simple code” is:
<?php
if (!file_exists('cache_image.png')) {
$img = file_get_contents('image_generator.png');
file_put_contents('cache_image.png',$img);
}else{
//i need to test if the source image have been updated
}
?>
I suggest creating a MD5 hash of each file and compare the hashes.