Here's my current code.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title> Reduce & Resize Images </title>
<?php
function CheckDirectory() {
$netDir = "Network_Images/*.png";
$locDir = "Local_Images/";
foreach (glob($netDir) as $net) {
$files = glob($locDir."/".substr($net, strpos($net, "/") + 1));
if (empty($files)) {
$im = imagecreatefrompng($net);
$new_image = imagecreatetruecolor(50, 50);
imagecopyresampled($new_image, $im, 0, 0, 0, 0, 50, 50, imagesx($im), imagesy($im));
$im = $new_image;
imagepng($im, $locDir.substr($net, strpos($net, "/") + 1), 0);
}
}
}
?>
<script type="text/javascript">
function init() {
console.log("timeout called");
document.write("<?php CheckDirectory(); ?>");
t = setTimeout(function() {init()}, 30000);
}
</script>
</head>
<body onload="init()">
<form action="" method="POST" enctype="multipart/form-data">
<label name="lblBrowser">Filename : </label>
<input type="file" name="fileUpload" id="fileUpload" /><br />
<input type="submit" value="Upload" id="Upload" />
</form>
</body>
</html>