diff --git a/archiepixa.sh b/archiepixa.sh index 726d132..2995c09 100644 --- a/archiepixa.sh +++ b/archiepixa.sh @@ -179,7 +179,7 @@ css=' width: 70%; display: block; } - }" + } ' # Function to compress and generate HTML links @@ -191,6 +191,7 @@ compress_and_generate_links() { declare -a text_files declare -a picture_files + declare -a gif_files declare -a video_files declare -a audio_files declare -a other_files @@ -204,9 +205,9 @@ compress_and_generate_links() { *.jpg|*.png|*.heic|*.svg|*.JPG|*.PNG|*.HEIC|*.SVG) picture_files+=("$file") ;; - # |*.gif|*.GIF) - # gif_files+=("$file") - # ;; + *.gif|*.GIF) + gif_files+=("$file") + ;; *.mp4|*.mov|*.mkv|*.avi|*.MP4) video_files+=("$file") ;; @@ -300,9 +301,9 @@ compress_and_generate_links() { compressed_file="$folder"/"$compressed_folder/$(basename "$picture_file")_compressed.jpg" if [ ! -f "$compressed_file" ]; then if $dither; then - convert "$picture_file" -dither Riemersma -colors $n_colors_dither -quality 85 "$compressed_file" + convert "$picture_file" -dither Riemersma -colors $n_colors_dither -quality 50 -resize 400x "$compressed_file" else - convert "$picture_file" -quality 85 "$compressed_file" + convert "$picture_file" -quality 50 -resize 400x "$compressed_file" fi fi echo "
@@ -312,6 +313,25 @@ compress_and_generate_links() { done fi + # Compress and display picture files in the subfolder + if [ ${#gif_files[@]} -gt 0 ]; then + # echo "
" >> "$index_file" + for gif_file in "${gif_files[@]}"; do + compressed_file="$folder"/"$compressed_folder/$(basename "$gif_file")_compressed.gif" + if [ ! -f "$compressed_file" ]; then + if $dither; then + convert "$gif_file" -dither Riemersma -colors $n_colors_dither -colors 8 -resize 50% "$compressed_file" + else + convert "$gif_file" -colors 8 -resize 50% "$compressed_file" + fi + fi + echo "
+ \"Compressed + Original ⇝ $(basename "$gif_file") +
" >> "$index_file" + done + fi + # Compress and display video files in the subfolder if [ ${#video_files[@]} -gt 0 ]; then # echo "
" >> "$index_file"