#!/bin/sh #set -x #chmod u+rx exifresize # Should only use no parameter if [[ $# -ne 0 ]]; then echo "Usage: $0" exit 1 fi for file in *.jpg; do echo "Processing $file..." # Get wigth and height from JPG imageArray=`exiftool -ImageWidth -ImageHeight -FileSize $file | awk '{ print $4 }'` #echo imageArray=$imageArray width=`echo $imageArray | awk '{ print $1 }'` height=`echo $imageArray | awk '{ print $2 }'` size=`echo $imageArray | awk '{ print $3 }'` #echo width=$width #echo height=$height #echo size=$size # Resize the pictures if [ $width -gt $height ]; then if [ $width -ne "640" -o $size -gt "50" ]; then convert -resize 640x480 -quality 75 $file $file #echo "Changed Sfile" fi else if [ $width -ne "480" -o $size -gt "50" ]; then convert -resize 480x640 -quality 75 $file $file #echo "Changed Sfile" fi fi done # Fixing file's timestamp echo "Adjusting the files' timestamp." exiftool '-DateTimeOriginal>FileModifyDate' . # gThumb changes SELinux security context # /usr/sbin/semanage fcontext -a -t httpd_user_content_t '/home/marc/public_html' # /sbin/restorecon -v /home/marc/public_html for file in `ls -Z *.jpg | grep user_home_t | awk '{ print $5 }'`; do echo "Processing $file for SELinux security context issue..." #ls -Z $file chcon -R -t httpd_user_content_t $file #ls -Z $file done