|
|
@ -179,7 +179,7 @@ css='
|
|
|
|
width: 70%;
|
|
|
|
width: 70%;
|
|
|
|
display: block;
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}"
|
|
|
|
}
|
|
|
|
'
|
|
|
|
'
|
|
|
|
|
|
|
|
|
|
|
|
# Function to compress and generate HTML links
|
|
|
|
# Function to compress and generate HTML links
|
|
|
@ -191,6 +191,7 @@ compress_and_generate_links() {
|
|
|
|
|
|
|
|
|
|
|
|
declare -a text_files
|
|
|
|
declare -a text_files
|
|
|
|
declare -a picture_files
|
|
|
|
declare -a picture_files
|
|
|
|
|
|
|
|
declare -a gif_files
|
|
|
|
declare -a video_files
|
|
|
|
declare -a video_files
|
|
|
|
declare -a audio_files
|
|
|
|
declare -a audio_files
|
|
|
|
declare -a other_files
|
|
|
|
declare -a other_files
|
|
|
@ -204,9 +205,9 @@ compress_and_generate_links() {
|
|
|
|
*.jpg|*.png|*.heic|*.svg|*.JPG|*.PNG|*.HEIC|*.SVG)
|
|
|
|
*.jpg|*.png|*.heic|*.svg|*.JPG|*.PNG|*.HEIC|*.SVG)
|
|
|
|
picture_files+=("$file")
|
|
|
|
picture_files+=("$file")
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
# |*.gif|*.GIF)
|
|
|
|
*.gif|*.GIF)
|
|
|
|
# gif_files+=("$file")
|
|
|
|
gif_files+=("$file")
|
|
|
|
# ;;
|
|
|
|
;;
|
|
|
|
*.mp4|*.mov|*.mkv|*.avi|*.MP4)
|
|
|
|
*.mp4|*.mov|*.mkv|*.avi|*.MP4)
|
|
|
|
video_files+=("$file")
|
|
|
|
video_files+=("$file")
|
|
|
|
;;
|
|
|
|
;;
|
|
|
@ -300,9 +301,9 @@ compress_and_generate_links() {
|
|
|
|
compressed_file="$folder"/"$compressed_folder/$(basename "$picture_file")_compressed.jpg"
|
|
|
|
compressed_file="$folder"/"$compressed_folder/$(basename "$picture_file")_compressed.jpg"
|
|
|
|
if [ ! -f "$compressed_file" ]; then
|
|
|
|
if [ ! -f "$compressed_file" ]; then
|
|
|
|
if $dither; 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
|
|
|
|
else
|
|
|
|
convert "$picture_file" -quality 85 "$compressed_file"
|
|
|
|
convert "$picture_file" -quality 50 -resize 400x "$compressed_file"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
echo "<div>
|
|
|
|
echo "<div>
|
|
|
@ -312,6 +313,25 @@ compress_and_generate_links() {
|
|
|
|
done
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Compress and display picture files in the subfolder
|
|
|
|
|
|
|
|
if [ ${#gif_files[@]} -gt 0 ]; then
|
|
|
|
|
|
|
|
# echo "<div class='pics'>" >> "$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 "<div>
|
|
|
|
|
|
|
|
<a href="\"/$compressed_file"\"><img loading=\"lazy\" src=\"/$compressed_file\" alt=\"Compressed Image\"></a>
|
|
|
|
|
|
|
|
<a href=\"$(basename "$gif_file")\" target=\"_blank\">Original ⇝ $(basename "$gif_file")</a>
|
|
|
|
|
|
|
|
</div>" >> "$index_file"
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Compress and display video files in the subfolder
|
|
|
|
# Compress and display video files in the subfolder
|
|
|
|
if [ ${#video_files[@]} -gt 0 ]; then
|
|
|
|
if [ ${#video_files[@]} -gt 0 ]; then
|
|
|
|
# echo "<div class='vids'>" >> "$index_file"
|
|
|
|
# echo "<div class='vids'>" >> "$index_file"
|
|
|
|