Added PNG metadata-stripping

This commit is contained in:
Jenga Phoenix 2019-01-27 01:51:11 -06:00
parent b2d80531e1
commit 5e58a61813
4 changed files with 18 additions and 4 deletions

View File

@ -30,7 +30,7 @@ switch (true) {
case (move_uploaded_file($_FILES["uploadcoin"]["tmp_name"], $dest_file) case (move_uploaded_file($_FILES["uploadcoin"]["tmp_name"], $dest_file)
&& write_metadata($dest_file, $_POST["file_source"])): && write_metadata($dest_file, $_POST["file_source"])):
if (in_array(file_extension($dest_file),array("jpg","jpeg"))) { if (is_image($dest_file)) {
sanitize_image($dest_file); sanitize_image($dest_file);
} }

View File

@ -41,7 +41,7 @@ $file_beam_dir = "p/"; // where the files go
// for sanitization of images (stripping EXIF, etc) with an external program. // for sanitization of images (stripping EXIF, etc) with an external program.
$image_sanitize_command = "jhead"; $image_sanitize_command = "mogrify";
$image_sanitize_args = "-purejpg"; $image_sanitize_args = "-strip";
?> ?>

View File

@ -54,5 +54,18 @@ function file_extension($file_name)
return strtolower(pathinfo($file_name, PATHINFO_EXTENSION)); return strtolower(pathinfo($file_name, PATHINFO_EXTENSION));
} }
// FILENAME --> BOOLEAN
// Return whether or not a filename has an 'image' file-extension
function is_image($file_name)
{
$file_ext = file_extension($file_name);
if (in_array(($file_ext), array("jpg", "jpeg", "jpg", "png"))) {
return 1;
} else {
return 0;
}
}
?> ?>

View File

@ -1,6 +1,7 @@
<div class="menu top-menu"> <div class="menu top-menu">
<h2><a href="/"><?php echo($GLOBALS["site_name"]); ?></a> <h2><a href="/"><?php echo($GLOBALS["site_name"]); ?></a>
<img id="duck" src="/res/img/war_duck.png"></h2> <img id="duck" src="/res/img/war_duck.png" alt="Warduck lives!">
</h2>
<ul> <ul>
<li><a href="/coin.php">file-beamer</a></li> <li><a href="/coin.php">file-beamer</a></li>
<li><a href="/mask.php">url-shortener</a></li> <li><a href="/mask.php">url-shortener</a></li>