Browse code

Added PNG metadata-stripping

Jenga Phoenix authored on 2019-01-27 07:51:11
Showing 4 changed files
... ...
@@ -30,7 +30,7 @@ switch (true) {
30 30
 	case (move_uploaded_file($_FILES["uploadcoin"]["tmp_name"], $dest_file)
31 31
 	&& write_metadata($dest_file, $_POST["file_source"])):
32 32
 
33
-		if (in_array(file_extension($dest_file),array("jpg","jpeg"))) {
33
+		if (is_image($dest_file)) {
34 34
 			sanitize_image($dest_file);
35 35
 		}
36 36
 
... ...
@@ -41,7 +41,7 @@ $file_beam_dir = "p/";		// where the files go
41 41
 
42 42
 
43 43
 // for sanitization of images (stripping EXIF, etc) with an external program.
44
-$image_sanitize_command = "jhead";
45
-$image_sanitize_args = "-purejpg";
44
+$image_sanitize_command = "mogrify";
45
+$image_sanitize_args = "-strip";
46 46
 
47 47
 ?>
... ...
@@ -54,5 +54,18 @@ function file_extension($file_name)
54 54
 	return strtolower(pathinfo($file_name, PATHINFO_EXTENSION));
55 55
 }
56 56
 
57
+// FILENAME --> BOOLEAN
58
+//	Return whether or not a filename has an 'image' file-extension
59
+function is_image($file_name)
60
+{
61
+	$file_ext = file_extension($file_name);
62
+
63
+	if (in_array(($file_ext), array("jpg", "jpeg", "jpg", "png"))) {
64
+		return 1;
65
+	} else {
66
+		return 0;
67
+	}
68
+}
69
+
57 70
 
58 71
 ?>
... ...
@@ -1,6 +1,7 @@
1 1
 <div class="menu top-menu">
2 2
 	<h2><a href="/"><?php echo($GLOBALS["site_name"]); ?></a>
3
-		<img id="duck" src="/res/img/war_duck.png"></h2>
3
+		<img id="duck" src="/res/img/war_duck.png" alt="Warduck lives!">
4
+	</h2>
4 5
 	<ul>
5 6
 		<li><a href="/coin.php">file-beamer</a></li>
6 7
 		<li><a href="/mask.php">url-shortener</a></li>