Skip to content
Snippets Groups Projects
Commit e395fd80 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Fix CRLF

parent d39dbe66
No related branches found
No related tags found
No related merge requests found
...@@ -37,7 +37,8 @@ optimize_image() ...@@ -37,7 +37,8 @@ optimize_image()
max_input_size=$(expr $max_input_size + $input_file_size) max_input_size=$(expr $max_input_size + $input_file_size)
if [ "${1##*.}" = "png" ]; then if [ "${1##*.}" = "png" ]; then
optipng -o1 -clobber -quiet $1 -out $2.firstpass #optipng -o1 -clobber -quiet $1 -out $2.firstpass
optipng -o1 -quiet $1 -out $2.firstpass
pngcrush -q -rem alla -reduce $2.firstpass $2 >/dev/null pngcrush -q -rem alla -reduce $2.firstpass $2 >/dev/null
rm -fr $2.firstpass rm -fr $2.firstpass
fi fi
...@@ -67,6 +68,25 @@ get_max_file_length() ...@@ -67,6 +68,25 @@ get_max_file_length()
main() main()
{ {
test=`type pngcrush >/dev/null 2>&1`
result=$?
if [ "x$result" == "x1" ]; then
echo "Tool pngcrush not found" && exit
fi
test=`type optipng >/dev/null 2>&1`
result=$?
if [ "x$result" == "x1" ]; then
echo "Tool optipng not found" && exit
fi
test=`type jpegtran >/dev/null 2>&1`
result=$?
if [ "x$result" == "x1" ]; then
echo "Tool jpegtran not found" && exit
fi
# If $INPUT is empty, then we use current directory # If $INPUT is empty, then we use current directory
if [[ "$INPUT" == "" ]]; then if [[ "$INPUT" == "" ]]; then
INPUT=$(pwd) INPUT=$(pwd)
...@@ -81,6 +101,8 @@ main() ...@@ -81,6 +101,8 @@ main()
OUTPUT='/tmp/optimize' OUTPUT='/tmp/optimize'
fi fi
echo "Mode is $INPLACE (0=Images are replaced, 1=New images are stored into $OUTPUT)"
# We create the output directory # We create the output directory
mkdir -p $OUTPUT mkdir -p $OUTPUT
...@@ -96,6 +118,7 @@ main() ...@@ -96,6 +118,7 @@ main()
# Search of all jpg/jpeg/png in $INPUT # Search of all jpg/jpeg/png in $INPUT
# We remove images from $OUTPUT if $OUTPUT is a subdirectory of $INPUT # We remove images from $OUTPUT if $OUTPUT is a subdirectory of $INPUT
echo "Scan $INPUT to find images"
IMAGES=$(find $INPUT -regextype posix-extended -regex '.*\.(jpg|jpeg|png)' | grep -v $OUTPUT) IMAGES=$(find $INPUT -regextype posix-extended -regex '.*\.(jpg|jpeg|png)' | grep -v $OUTPUT)
if [ "$QUIET" == "0" ]; then if [ "$QUIET" == "0" ]; then
...@@ -103,6 +126,7 @@ main() ...@@ -103,6 +126,7 @@ main()
echo echo
fi fi
for CURRENT_IMAGE in $IMAGES; do for CURRENT_IMAGE in $IMAGES; do
echo "Process $CURRENT_IMAGE"
filename=$(basename $CURRENT_IMAGE) filename=$(basename $CURRENT_IMAGE)
if [ "$QUIET" == "0" ]; then if [ "$QUIET" == "0" ]; then
printf '%s ' "$filename" printf '%s ' "$filename"
......
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment