Browse Source

Add files via upload

Daniele Bonini (皮夕): WebDev, DevOps and homomm.org by lots of Simplicity bits 3 years ago
parent
commit
4cf6562bef
1 changed files with 19 additions and 0 deletions
  1. 19 0
      Private/functions/funct.inc

+ 19 - 0
Private/functions/funct.inc

@@ -78,6 +78,25 @@ function HTMLencode(?string $s, bool $withBR = false): string
 } 
 }
 
+
+if (!function_exists("is_image")) {
+/**
+ * Determine if the given file is an image 
+ * 
+ * @param string $file the file being checked
+ * @return bool true/false if a file is an image    
+ */  
+function is_image(string $file) {
+  $fileExt = strtolower(pathinfo($file, PATHINFO_EXTENSION));
+  if ($fileExt === "gif" || $fileExt === "png" || $fileExt === "jpg" || $fileExt === "jpeg") {
+    return true;
+  } else {
+    return false;
+  }      
+} 
+}  
+
+
 if (!function_exists("is_word")) {
 /**
  * Determine if the given string is a word