Showing 1 changed files with 10 additions and 7 deletions
+10 -7
thumbnails
... ...
@@ -47,12 +47,12 @@ if ! which convert > /dev/null; then
47 47
     exit 1
48 48
 fi
49 49
 
50
-sqlcmd="select path from ${dbprefix}images \
51
-           where id in ( \
52
-              select distinct image_id from ${dbprefix}image_category \
53
-                  where category_id in ( \
54
-                      select id from ${dbprefix}categories where dir is NULL \
55
-                  ) \
50
+sqlcmd="select path from ${dbprefix}images
51
+           where id in (
52
+              select distinct image_id from ${dbprefix}image_category
53
+                  where category_id in (
54
+                      select id from ${dbprefix}categories where dir is ${IMPORT:+not} NULL
55
+                  )
56 56
            )"
57 57
 
58 58
 IFS=$'\n'
... ...
@@ -65,7 +65,7 @@ for file in $(mysql -N -u $dbuser -p${dbpasswd} $dbname <<< $sqlcmd); do
65 65
     cmd="sudo -u www-data convert \"$site/$file\" -write mpr:image +delete "
66 66
     count=0
67 67
     for size in ${!imgsize[@]}; do
68
-        if ! test -e "${destDir}/${fnNoExt}-${size:0:2}.$fnExt"; then
68
+        if ! test -e "${destDir}/${fnNoExt}-${size:0:2}.$fnExt" -a -z "$FORCE"; then
69 69
             format+="$size "
70 70
             cmd+="mpr:image -filter Lanczos -auto-orient -strip -quality 95 -interlace line -sampling-factor 4:2:2 "
71 71
             cmd+="-resize ${width[$size]}x${height[$size]} -write \"${destDir}/${fnNoExt}-${size:0:2}.$fnExt\" +delete "
... ...
@@ -74,6 +74,9 @@ for file in $(mysql -N -u $dbuser -p${dbpasswd} $dbname <<< $sqlcmd); do
74 74
     done
75 75
     if test -n "$format"; then
76 76
         echo "$site/$file : $format"
77
+        if test -n "$LIST"; then
78
+            continue
79
+        fi
77 80
         echo -n "please wait... "
78 81
         cmd=$(sed -r 's/^(.+) -write (.*) \+delete $/\1 \2/' <<< $cmd)
79 82
         eval $(echo -e nice -20 $cmd)