wok rev 21769

sane-backends: enlarge preview image
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Jul 01 12:04:05 2019 +0200 (12 months ago)
parents ab1b43f95995
children f1e92a9bbf08
files sane-backends/stuff/tazpanel/sane.cgi
line diff
     1.1 --- a/sane-backends/stuff/tazpanel/sane.cgi	Sun Jun 30 11:35:08 2019 +0200
     1.2 +++ b/sane-backends/stuff/tazpanel/sane.cgi	Mon Jul 01 12:04:05 2019 +0200
     1.3 @@ -93,7 +93,7 @@
     1.4  	*)	echo -n "scanimage -d '$(echo $device | sed 's/,.*//')' --resolution '$(inrange $resolution $(xPOST res_min) $(xPOST res_max))dpi'$CMD"
     1.5  		if [ -z "$1" -a "$(which convert)" ]; then
     1.6  			echo -n "> /tmp/sane$$.pnm ; convert -resize "
     1.7 -			echo $ARGS $(GET width) | awk '{ printf "%dx%d",$5,int(($2*$5)/$1)}'
     1.8 +			echo $ARGS 1024 | awk '{ printf "%dx%d",$5,int(($2*$5)/$1)}'
     1.9  			echo -n " /tmp/sane$$.pnm /tmp/sane$$.png ;"
    1.10  			echo -n "cat /tmp/sane$$.png ; rm -f /tmp/sane$$.pn?"
    1.11  		fi
    1.12 @@ -109,8 +109,12 @@
    1.13  	case "$1" in
    1.14  	list)
    1.15  		echo -n "<option value=\"$key\""
    1.16 -		[ "$(which $exe 2> /dev/null)" ] || 
    1.17 -		echo -n " disabled title=\"$exe not found: install $pkg\""
    1.18 +		disabled=""
    1.19 +		for i in ${exe//|/ }; do
    1.20 +			[ "$(which $i 2> /dev/null)" ] || 
    1.21 +			disabled=" disabled title=\"$i not found: install package $pkg\""
    1.22 +		done
    1.23 +		echo -n "$disabled"
    1.24  		[ "$key" == "pnm" ] &&
    1.25  		echo -n " title=\"not supported by most browsers\""
    1.26  		echo ">$key" ;;
    1.27 @@ -141,6 +145,7 @@
    1.28  		esac ;;
    1.29  	esac
    1.30  done <<EOT
    1.31 +#png		tazsane.png		image/png		pnm2png|convert		imagemagick 	> $tmp.pnm; [ "$(which pnm2png)" ] && pnm2png < $tmp.pnm || convert $tmp.pnm png:-
    1.32  png		tazsane.png		image/png		convert		imagemagick 	> $tmp.pnm; convert $tmp.pnm png:-
    1.33  jpeg		tazsane.jpg		image/jpeg		convert		imagemagick 	> $tmp.pnm; convert $tmp.pnm jpg:-
    1.34  jpeg2000	tazsane.jp2		image/jpeg2000-image	convert		imagemagick 	> $tmp.pnm; convert $tmp.pnm jp2:-
    1.35 @@ -324,7 +329,6 @@
    1.36  } END { print "" }
    1.37  ' | sed 1d)"
    1.38  fi
    1.39 -echo "<!-- $params -->"
    1.40  output="$(n=$(echo "$params" | wc -l); echo "$params" | \
    1.41  while read name def min max help; do
    1.42  	name="${name#-}"
    1.43 @@ -357,7 +361,7 @@
    1.44  		[ "$(xPOST $name)" ] && def=$(xPOST $name)
    1.45  		[ $def -lt $min ] && def=$min
    1.46  		[ $def -gt $max ] && def=$max
    1.47 -		f="<fieldset><legend>$(_ "$name")</legend><input name=\"$name\" value=\"$def\""
    1.48 +		f="<fieldset><legend>$(_ "$name")</legend><input type=\"range\" min=\"$min\" max=\"$max\" name=\"$name\" value=\"$def\""
    1.49  		u=""
    1.50  		case "$name" in
    1.51  		x|y|l|t) cat <<EOT
    1.52 @@ -455,7 +459,7 @@
    1.53  [ -s "$tmpreview" ] && cat <<EOT
    1.54  <div margin="15px" style="overflow-x: auto">
    1.55  	<script type="text/javascript" src="lib/crop.js"></script>
    1.56 -	<img src="$tmpreview" onload=cropInit(this,'x','y','width','height')>
    1.57 +	<img src="$tmpreview" style="width:100%" onload=cropInit(this,'x','y','width','height')>
    1.58  </div>
    1.59  EOT
    1.60  xhtml_footer