Code: Seeing if an image has been updated.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
andrewmg
Forum Newbie
Posts: 2
Joined: Mon Dec 08, 2008 4:09 pm

Code: Seeing if an image has been updated.

Post by andrewmg »

revised
Last edited by andrewmg on Mon Dec 08, 2008 6:46 pm, edited 1 time in total.
andrewmg
Forum Newbie
Posts: 2
Joined: Mon Dec 08, 2008 4:09 pm

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

Post 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
Post Reply