فهرست منبع

fix #2750 change image_size, replace with -singlefile, and add -f

Shinsuke Sugaya 2 سال پیش
والد
کامیت
bc337f84b2
1فایلهای تغییر یافته به همراه12 افزوده شده و 12 حذف شده
  1. 12 12
      src/main/assemblies/files/generate-thumbnail

+ 12 - 12
src/main/assemblies/files/generate-thumbnail

@@ -3,7 +3,7 @@
 cmd_type=$1
 url=$2
 output_file=$3
-image_size=100x100!
+image_size=100x100
 target_file=$(echo "$url" | sed -e "s#^file:/*#/#g")
 
 check_command() {
@@ -30,28 +30,28 @@ if [[ x"${cmd_type}" = "xmsoffice" ]] ; then
     exit 1
   fi
   tmp_png_prefix=/tmp/thumbnail.png.$$
-  pdftoppm -png -l 1 ${tmp_pdf_file} ${tmp_png_prefix}
-  tmp_png_file="${tmp_png_prefix}-1.png"
-  rm ${tmp_pdf_file}
+  pdftoppm -png -singlefile ${tmp_pdf_file} ${tmp_png_prefix}
+  tmp_png_file="${tmp_png_prefix}.png"
+  rm -f ${tmp_pdf_file}
   if [[ ! -f ${tmp_png_file} ]] ; then
     echo "pdftoppm does not work."
     exit 1
   fi
   convert -thumbnail ${image_size} ${tmp_png_file} "${output_file}"
-  rm ${tmp_png_prefix}*png
+  rm -f ${tmp_png_prefix}*png
 elif [[ x"${cmd_type}" = "xpdf" ]] ; then
   check_command convert
   check_command pdftoppm
   target_file=$(echo "$url" | sed -e "s#^file:/*#/#g")
   tmp_png_prefix=/tmp/thumbnail.png.$$
-  pdftoppm -png -l 1 "${target_file}" ${tmp_png_prefix}
-  tmp_png_file="${tmp_png_prefix}-1.png"
+  pdftoppm -png -singlefile "${target_file}" ${tmp_png_prefix}
+  tmp_png_file="${tmp_png_prefix}.png"
   if [[ ! -f ${tmp_png_file} ]] ; then
     echo "pdftoppm does not work."
     exit 1
   fi
   convert -thumbnail ${image_size} ${tmp_png_file} "${output_file}"
-  rm ${tmp_png_prefix}*png
+  rm -f ${tmp_png_prefix}*png
 elif [[ x"${cmd_type}" = "xps" ]] ; then
   check_command convert
   check_command pdftoppm
@@ -64,15 +64,15 @@ elif [[ x"${cmd_type}" = "xps" ]] ; then
     exit 1
   fi
   tmp_png_prefix=/tmp/thumbnail.png.$$
-  pdftoppm -png -l 1 ${tmp_pdf_file} ${tmp_png_prefix}
-  tmp_png_file="${tmp_png_prefix}-1.png"
-  rm ${tmp_pdf_file}
+  pdftoppm -png -singlefile ${tmp_pdf_file} ${tmp_png_prefix}
+  tmp_png_file="${tmp_png_prefix}.png"
+  rm -f ${tmp_pdf_file}
   if [[ ! -f ${tmp_png_file} ]] ; then
     echo "pdftoppm does not work."
     exit 1
   fi
   convert -thumbnail ${image_size} ${tmp_png_file} "${output_file}"
-  rm ${tmp_png_prefix}*png
+  rm -f ${tmp_png_prefix}*png
 elif [[ x"${cmd_type}" = "ximage" ]] ; then
   check_command convert
   target_file=$(echo "$url" | sed -e "s#^file:/*#/#g")