Page 1 of 1

Code: Seeing if an image has been updated.

Posted: Mon Dec 08, 2008 4:20 pm
by andrewmg
revised

Re: Code: Seeing if an image has been updated.

Posted: Mon Dec 08, 2008 6:14 pm
by andrewmg
revision, I fixed the resource, but I'm now getting a seperate problem.

Code: Select all

<?php
$imagefile = "image.jpg";
$your_data = date("m/d/y H:i:s", filemtime("image.jpg"));
$myFile = "time.txt";
$fh = fopen($myFile, 'r');
$theData = fread($fh, filesize($myFile));
if ($your_data == $theData) {
        echo "<img src='image.jpg'><br>File has not been updated <br>$your_data<br>$theData";
}
if ($your_data != $theData) {
        echo "<img src='image.jpg'><br>File has been updated, <br>$your_data<br>$theData<br>";
}
 
?>

now it outputs the same thing, even if they file has not updated.
File has been updated,
12/07/08 11:03:13
12/07/08 11:03:13