Fix issue with auto sized images
This commit is contained in:
parent
348117efb8
commit
37519f42b1
1 changed files with 12 additions and 16 deletions
28
neofetch
28
neofetch
|
@ -2229,7 +2229,9 @@ getimage () {
|
||||||
|
|
||||||
"none")
|
"none")
|
||||||
# Get image size so that we can do a better crop
|
# Get image size so that we can do a better crop
|
||||||
getimgsize "$img"
|
size=$(identify -format "%w %h" "$img")
|
||||||
|
width=${size%% *}
|
||||||
|
height=${size##* }
|
||||||
crop_mode="none"
|
crop_mode="none"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
@ -2259,19 +2261,23 @@ getimage () {
|
||||||
# Check to see if the image has a file extension, if it doesn't
|
# Check to see if the image has a file extension, if it doesn't
|
||||||
# then add one.
|
# then add one.
|
||||||
case "${img##*/}" in
|
case "${img##*/}" in
|
||||||
*"."*) imgname="$crop_mode-$crop_offset-$image_size-${img##*/}" ;;
|
*"."*) imgname="$crop_mode-$crop_offset-$width-$height-${img##*/}" ;;
|
||||||
*) imgname="$crop_mode-$crop_offset-$image_size-${img##*/}.jpg" ;;
|
*) imgname="$crop_mode-$crop_offset-$width-$height-${img##*/}.jpg" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Check to see if the thumbnail exists before we do any cropping.
|
# Check to see if the thumbnail exists before we do any cropping.
|
||||||
if [ ! -f "$thumbnail_dir/$imgname" ]; then
|
if [ ! -f "$thumbnail_dir/$imgname" ]; then
|
||||||
# Get image size so that we can do a better crop
|
# Get image size so that we can do a better crop
|
||||||
getimgsize "$img"
|
if [ -z "$size" ]; then
|
||||||
|
size=$(identify -format "%w %h" "$img")
|
||||||
|
og_width=${size%% *}
|
||||||
|
og_height=${size##* }
|
||||||
|
fi
|
||||||
|
|
||||||
# This checks to see if height is geater than width
|
# This checks to see if height is geater than width
|
||||||
# so we can do a better crop of portrait images.
|
# so we can do a better crop of portrait images.
|
||||||
size=$height
|
size=$og_height
|
||||||
[ "$height" -gt "$width" ] && size=$width
|
[ "$og_height" -gt "$og_width" ] && size=$og_width
|
||||||
|
|
||||||
case "$crop_mode" in
|
case "$crop_mode" in
|
||||||
fit)
|
fit)
|
||||||
|
@ -2348,16 +2354,6 @@ getw3m_img_path () {
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
# Get Image Size {{{
|
|
||||||
|
|
||||||
getimgsize () {
|
|
||||||
size=$(identify -format "%w %h" "$1")
|
|
||||||
width=${size%% *}
|
|
||||||
height=${size##* }
|
|
||||||
}
|
|
||||||
|
|
||||||
# }}}
|
|
||||||
|
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue