public inbox for test-list@sourceware.org help / color / mirror / Atom feed
From: Jason Molenda <jason-swarelist@molenda.com> To: test-list@sources.redhat.com Subject: This is a normal message Date: Sun, 11 Nov 2001 09:05:00 -0000 [thread overview] Message-ID: <20011113013925.A15231@shell17.ba.best.com> (raw) [-- Attachment #1: Type: text/plain, Size: 37 bytes --] Watch my normality. And a patch. J [-- Attachment #2: pa.txt --] [-- Type: text/plain, Size: 3612 bytes --] =================================================================== RCS file: makethumbs.sh,v retrieving revision 1.56 diff -up -r1.56 makethumbs.sh --- makethumbs.sh 2001/11/07 05:25:44 1.56 +++ makethumbs.sh 2001/11/08 06:09:08 @@ -208,6 +208,7 @@ init_defaults () DEFAULT_reduce_trigger_width=1024 DEFAULT_reduce_height=600 DEFAULT_reduce_width=800 + DEFAULT_remove_originals=0 t=`pwd` DEFAULT_pwd_english=`basename "$t"` DEFAULT_rotation_file="rot-state.txt" @@ -223,6 +224,7 @@ init_defaults () GLOBAL_reduce_width=$DEFAULT_reduce_width GLOBAL_pwd_english="$DEFAULT_pwd_english" GLOBAL_rotation_file=$DEFAULT_rotation_file + GLOBAL_remove_originals=$DEFAULT_remove_originals } parse_args () @@ -262,6 +264,10 @@ parse_args () ARGV_use_two_windows=1 GLOBAL_use_two_windows=$ARGV_use_two_windows ;; + --remove-orig*) + ARGV_remove_originals=1 + GLOBAL_remove_originals=$ARGV_remove_originals + ;; --disable-reduce) ARGV_reduce_big_pics=0 GLOBAL_reduce_big_pics=$ARGV_reduce_big_pics @@ -339,6 +345,10 @@ Usage: `basename $0` [--maxthumbsize=n] --disable-reduce Don't create a reduced img if the picture is large --use-two-windows Bring up a new window to see images, default is `[ $DEFAULT_use_two_windows -eq 1 ] && echo enabled || echo disabled` +--remove-originals Remove original images if we make reduced versions. + Useful when disk space is limited; default is `[ $DEFAULT_use_two_windows -eq 1 ] && echo enabled || echo disabled` + WARNING!!! This option *will* remove your original images if + reduced images are available! Run this script in a directory of JPEG files to create thumbnail images and an index.html. If an index.html is already present, its HTML is sent to stdout. @@ -455,10 +465,50 @@ print_image_entry () create_reduced "$pie_fn" was_reduced=$RETURN_was_reduced + if [ $was_reduced -eq 1 ] + then + maybe_remove_original "$pie_fn" $was_reduced + if [ $RETURN_original_removed -eq 1 ] + then + was_reduced=0 + fi + fi + print_image_link $thumb_width $thumb_height $was_reduced "$pie_fn" print_image_size "$pie_fn" } +maybe_remove_original () +{ + mro_name="$1" + mro_was_reduced="$2" + RETURN_original_removed=0 + RETURN_reduced_still_around=1 + + [ "$mro_was_reduced" -eq 0 ] && return + [ "$GLOBAL_remove_originals" -eq 0 ] && return + + source_name_to_reduced_name "$mro_name" + mro_reduced_name="$RETURN_reduced_name" + + if [ -f "$mro_name" -a -f "$mro_reduced_name" -a -s "$mro_reduced_name" ] + then + mv "$mro_name" "${mro_name}.bak" + mv "$mro_reduced_name" "$mro_name" + fi + + if [ ! -f "$mro_reduced_name" -a -f "$mro_name" -a -s "$mro_name" ] + then + rm -f "${mro_name}.bak" + RETURN_original_removed=1 + RETURN_reduced_still_around=0 + else + echo ERROR: I got confused while trying to remove original file >&2 + echo ERROR: \"$mro_name\"! Aborting... >&2 + exit 1 + fi +} + get_file_english_name () { gfen_fn="$*" @@ -751,7 +801,7 @@ print_html_footer () <!-- This file generated automatically by makethumbs.sh, written by Jason Molenda, makethumbs(AT)molenda.com. - RCS Id: $Id: makethumbs.sh,v 1.56 2001/11/07 05:25:44 molenda Exp molenda $ + RCS Id: $Id: makethumbs.sh,v 1.56 2001/11/07 05:25:44 molenda Exp $ The latest version of this script is always available at http://www.molenda.com/makethumbs/ -->
reply other threads:[~2001-11-13 9:39 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20011113013925.A15231@shell17.ba.best.com \ --to=jason-swarelist@molenda.com \ --cc=test-list@sources.redhat.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).