filemtime($my_output_file)) { // Delay .25s just in case the file is still uploading to server usleep(250000); // create image in memory // if your image is png... // $src_img = imagecreatefrompng($my_input_file); $src_img = imagecreatefromjpeg($my_input_file); $dst_img = imagecreatetruecolor($thumb_width,$thumb_height); imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $thumb_width, $thumb_height, $size[0], $size[1]); // write output image imagejpeg($dst_img, $my_output_file, $jpeg_quality); // free memory used imagedestroy($src_img); imagedestroy($dst_img); // If radar image is over 20 minutes old, add text that radar is down } else if (filemtime($my_input_file) < $mytime - 1200) { // create image in memory // if your image is png... // $src_img = imagecreatefrompng($my_input_file); $src_img = imagecreatefromjpeg($my_input_file); $dst_img = imagecreatetruecolor($thumb_width,$thumb_height); imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $thumb_width, $thumb_height, $size[0], $size[1]); // If radar image is over 20 minutes old, add text that radar is down $white = imagecolorallocate ($dst_img, 255,255,255); imagestring($dst_img,2,20,50,"RADAR DOWN",$white); imagestring($src_img,2,230,270,"RADAR DOWN",$white); // write output image imagejpeg($dst_img, $my_output_file, $jpeg_quality); imagejpeg($src_img, $my_input_file, 100); // free memory used imagedestroy($src_img); imagedestroy($dst_img); } ?>