image: Add support for all image formats that imagemagick supports.

This commit is contained in:
dylan araps 2017-07-28 21:54:58 +10:00
parent af09dc29bf
commit 6cc08b5477

View file

@ -2277,7 +2277,7 @@ get_image_source() {
if [[ -d "$image_source" ]]; then if [[ -d "$image_source" ]]; then
shopt -s nullglob shopt -s nullglob
files=("${image_source%/}"/*.{png,jpg,jpeg,jpe,gif}) files=("${image_source%/}"/*.{png,jpg,jpeg,jpe,gif,svg})
shopt -u nullglob shopt -u nullglob
image="${files[RANDOM % ${#files[@]}]}" image="${files[RANDOM % ${#files[@]}]}"
@ -2497,14 +2497,7 @@ get_image_size() {
make_thumbnail() { make_thumbnail() {
# Name the thumbnail using variables so we can # Name the thumbnail using variables so we can
# use it later. # use it later.
image_name="$crop_mode-$crop_offset-$width-$height" image_name="$crop_mode-$crop_offset-$width-$height-${image//\//_}.jpg"
# Check to see if the image has a file extension,
# if it doesn't then add one.
case "${image##*/}" in
*"."*) image_name="${image_name}-${image##*/}" ;;
*) image_name="${image_name}-${image##*/}.jpg" ;;
esac
# Create the thumbnail dir if it doesn't exist. # Create the thumbnail dir if it doesn't exist.
mkdir -p "$thumbnail_dir" mkdir -p "$thumbnail_dir"