1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-03-14 12:40:13 +01:00

Merge pull request #2505 from bantu/ticket/12582-ascraeus

[ticket/12582] Strip away copyrighted ICC profile from images

* bantu/ticket/12582-ascraeus:
  [ticket/12582] Use the correct script name.
  [ticket/12582] Fix coding style.
  [ticket/12582] Remove set -e due to exiftool not liking 0 byte files.
  [ticket/12582] Strip away copyrighted ICC profile
  [ticket/12582] Change strip_icc_profiles.sh to only take a single file.
  [ticket/12582] Run strip_icc_profiles.sh on Travis CI.
  [ticket/12582] Overwrite inplace instead of creating _original files.
  [ticket/12582] Add script for strippping ICC profiles from images.
This commit is contained in:
Joas Schilling 2014-05-28 21:50:19 +02:00
commit 3021a6e12a
6 changed files with 56 additions and 0 deletions

View File

@ -37,6 +37,7 @@ before_script:
script:
- travis/phing-sniff.sh $DB $TRAVIS_PHP_VERSION
- travis/check-image-icc-profiles.sh $DB $TRAVIS_PHP_VERSION
- phpBB/vendor/bin/phpunit --configuration travis/phpunit-$DB-travis.xml
- sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.5' -a '$DB' = 'mysqli' -a '$TRAVIS_PULL_REQUEST' != 'false' ]; then git-tools/commit-msg-hook-range.sh origin/$TRAVIS_BRANCH..FETCH_HEAD; fi"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

View File

@ -0,0 +1,26 @@
#!/bin/sh
#
# @copyright (c) 2014 phpBB Group
# @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
#
if [ "$#" -ne 1 ]
then
SCRIPT=$(basename "$0")
echo "Description: Finds and strips ICC Profiles from given image file." >&2
echo "Usage: $SCRIPT /path/to/image/file" >&2
echo "Exit Status: 0 if no ICC profiles have been stripped, otherwise 1." >&2
echo "Requires: exiftool" >&2
exit 1
fi
FILE=$1
HASH_OLD=$(md5sum "$FILE")
exiftool -icc_profile"-<=" -overwrite_original_in_place "$FILE" > /dev/null 2>&1
HASH_NEW=$(md5sum "$FILE")
if [ "$HASH_OLD" != "$HASH_NEW" ]
then
echo "Stripped ICC Profile from $FILE."
exit 1
fi

View File

@ -0,0 +1,15 @@
#!/bin/bash
#
# @copyright (c) 2014 phpBB Group
# @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
#
set -e
DB=$1
TRAVIS_PHP_VERSION=$2
if [ "$TRAVIS_PHP_VERSION" == "5.5" -a "$DB" == "mysqli" ]
then
find . -type f -not -path './phpBB/vendor/*' -iregex '.*\.\(gif\|jpg\|jpeg\|png\)$' | \
parallel --gnu --keep-order 'phpBB/develop/strip_icc_profiles.sh {}'
fi

9
travis/setup-exiftool.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/sh
#
# @copyright (c) 2014 phpBB Group
# @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
#
set -e
sudo apt-get update
sudo apt-get install -y parallel libimage-exiftool-perl

View File

@ -14,6 +14,11 @@ set -x
DB=$1
TRAVIS_PHP_VERSION=$2
if [ "$TRAVIS_PHP_VERSION" == "5.5" -a "$DB" == "mysqli" ]
then
travis/setup-exiftool.sh
fi
if [ "$DB" == "mariadb" ]
then
travis/setup-mariadb.sh