From 6e0c1ebca9ad25611b1f6b3ff6a523742a0f9627 Mon Sep 17 00:00:00 2001 From: AngelJumbo <31261193+AngelJumbo@users.noreply.github.com> Date: Wed, 18 Dec 2024 21:29:07 -0500 Subject: [PATCH] Revert "Image optimization" --- .gitignore | 1 - build.sh | 137 ++++++++++++++++++++++------------------------------- 2 files changed, 57 insertions(+), 81 deletions(-) diff --git a/.gitignore b/.gitignore index 3e04a05..2d19fc7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ *.html -.minified/ diff --git a/build.sh b/build.sh index 0947536..472f81d 100755 --- a/build.sh +++ b/build.sh @@ -20,44 +20,16 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -write_section_header() { - echo "

" >>$3 - echo "$2" | tr a-z A-Z >>$3 - echo "

" >>$3 + +write_section_header(){ + echo "

" >> $3 + echo "$2" | tr a-z A-Z >> $3 + echo "

" >> $3 } -MINIFIED_IMAGES_DIR='.minified' -IMAGE_PREVIEW_WIDTH=200 - -# Returns path to minified img or default img if no tools for minification -minify_image() { - local image=$1 - - if ! [ "$(command -v magick)" ]; then - echo "${image}" - return - fi - - local preview_image - preview_image="${MINIFIED_IMAGES_DIR}/${image}.min.png" - - mkdir -p "$(dirname "${preview_image}")" - - magick convert "${image}" -resize "${IMAGE_PREVIEW_WIDTH}" -format png -write "${preview_image}" - echo "${preview_image}" -} - -write_img() { - local image=$1 - local output=$2 - - local preview_image - preview_image=$(minify_image "${image}") - - echo " - - Preview of ${image} image - " >>"${output}" +write_img(){ + echo " +$1" >> $2 } rm *.html @@ -91,67 +63,71 @@ echo "
-

Gruvbox Wallpapers

" >./index.html +

Gruvbox Wallpapers

" > ./index.html color=1 -maxPerPage=8 +maxPerPage=8 declare -a sections -for subdir in ./wallpapers/*; do - section="${subdir##*/}" - sections+=("$section") - write_section_header $color "$section" ./index.html +for subdir in ./wallpapers/* +do + section="${subdir##*/}" + sections+=("$section") + write_section_header $color "$section" ./index.html - page=1 - img_count=0 - subhtml="${section}_page${page}.html" - touch ./$subhtml - echo "
" >>./index.html + page=1 + img_count=0 + subhtml="${section}_page${page}.html" + touch ./$subhtml - echo "
" >>./index.html - countImgs=$(find "$subdir" -type f | wc -l) - countImgs=$((countImgs - 1)) - for i in $(seq 1 $(((countImgs / maxPerPage) + 1))); do - echo "" >>./index.html - done - echo "
" >>./index.html - echo "
" >>./index.html - echo "
" >>./$subhtml - for wallpaper in ${subdir}/*; do - if [ "$img_count" -ge $maxPerPage ]; then + echo "
" >> ./index.html - echo "
" >>./$subhtml - page=$((page + 1)) - subhtml="${section}_page${page}.html" - touch ./$subhtml + echo "
" >> ./index.html + countImgs=$(find "$subdir" -type f | wc -l) + countImgs=$((countImgs - 1)) + for i in $(seq 1 $((( $countImgs / $maxPerPage)+1))); do + echo "" >> ./index.html + done + echo "
" >> ./index.html + echo "
" >> ./index.html + echo "
" >> ./$subhtml + for wallpaper in ${subdir}/* + do + if [ "$img_count" -ge $maxPerPage ]; then - echo "
" >>./$subhtml - img_count=0 - fi + echo "
" >> ./$subhtml + page=$((page + 1)) + subhtml="${section}_page${page}.html" + touch ./$subhtml - write_img $wallpaper ./$subhtml - img_count=$((img_count + 1)) - done - echo "
" >>./$subhtml + echo "
" >> ./$subhtml + img_count=0 + fi - echo "
" >>./index.html - echo "
" >>./index.html + write_img $wallpaper ./$subhtml + img_count=$((img_count + 1)) + done - color=$((color + 1)) - if [ "$color" -eq 8 ]; then - color=1 - fi + echo "
" >> ./$subhtml + + echo "
" >> ./index.html + echo "
" >> ./index.html + + color=$((color + 1)) + if [ "$color" -eq 8 ]; then + color=1 + fi done -echo "
" >>./index.html +echo "" >> ./index.html echo "" >>./index.html +" >> ./index.html + echo " -" >>./index.html +" >> ./index.html