aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/develop
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@phpbb.com>2014-05-27 01:13:22 +0200
committerAndreas Fischer <bantu@phpbb.com>2014-05-27 13:13:29 +0200
commitaf05015a693ef28cf6a38e449a375d4593a41253 (patch)
tree6b94a5f198cc28c03f343c7c5d5922e91e658e9f /phpBB/develop
parent223058c8c69203c48411f14e95b1ee36226ac5c8 (diff)
downloadforums-af05015a693ef28cf6a38e449a375d4593a41253.tar
forums-af05015a693ef28cf6a38e449a375d4593a41253.tar.gz
forums-af05015a693ef28cf6a38e449a375d4593a41253.tar.bz2
forums-af05015a693ef28cf6a38e449a375d4593a41253.tar.xz
forums-af05015a693ef28cf6a38e449a375d4593a41253.zip
[ticket/12582] Add script for strippping ICC profiles from images.
PHPBB3-12582
Diffstat (limited to 'phpBB/develop')
-rwxr-xr-xphpBB/develop/strip_icc_profiles.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/phpBB/develop/strip_icc_profiles.sh b/phpBB/develop/strip_icc_profiles.sh
new file mode 100755
index 0000000000..c9c77bda38
--- /dev/null
+++ b/phpBB/develop/strip_icc_profiles.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+#
+# @copyright (c) 2014 phpBB Group
+# @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+#
+set -e
+set -x
+
+SCRIPT=$(basename "$0")
+if [ "$#" -ne 1 ]; then
+ echo "Description: Finds and strips ICC Profiles from image files." >&2
+ echo "Usage: $SCRIPT /root/directory" >&2
+ echo "Exit Status: 0 if no ICC profiles have been stripped, otherwise 1." >&2
+ echo "Requires: exiftool" >&2
+ exit 1
+fi
+
+ROOT=$1
+STATUS=0
+for FILE in $(find "$ROOT" -type f -iregex '.*\.\(gif\|jpg\|jpeg\|png\)$')
+do
+ HASH_OLD=$(md5sum "$FILE")
+ exiftool -icc_profile"-<=" "$FILE" > /dev/null 2>&1
+ HASH_NEW=$(md5sum "$FILE")
+
+ if [ "$HASH_OLD" != "$HASH_NEW" ]
+ then
+ echo "Stripped ICC Profile from $FILE."
+ STATUS=1
+ fi
+done
+
+exit $STATUS