diff --git a/public_html/private/beam.php b/public_html/private/beam.php index 525de88..272c108 100644 --- a/public_html/private/beam.php +++ b/public_html/private/beam.php @@ -30,7 +30,7 @@ switch (true) { case (move_uploaded_file($_FILES["uploadcoin"]["tmp_name"], $dest_file) && 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); } diff --git a/resources/config.example.php b/resources/config.example.php index d40c584..60bb07c 100644 --- a/resources/config.example.php +++ b/resources/config.example.php @@ -41,7 +41,7 @@ $file_beam_dir = "p/"; // where the files go // for sanitization of images (stripping EXIF, etc) with an external program. -$image_sanitize_command = "jhead"; -$image_sanitize_args = "-purejpg"; +$image_sanitize_command = "mogrify"; +$image_sanitize_args = "-strip"; ?> diff --git a/resources/library/file.php b/resources/library/file.php index 868139f..ce1faf5 100644 --- a/resources/library/file.php +++ b/resources/library/file.php @@ -54,5 +54,18 @@ function file_extension($file_name) 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; + } +} + ?> diff --git a/resources/templates/menu.php b/resources/templates/menu.php index adf2836..ce690fe 100644 --- a/resources/templates/menu.php +++ b/resources/templates/menu.php @@ -1,6 +1,7 @@