From 799f4f21a078d5120cfda9411a8a325539661970 Mon Sep 17 00:00:00 2001 From: Lars Magne Ingebrigtsen Date: Thu, 2 Sep 2010 00:43:27 +0200 Subject: [PATCH] Yet another try at getting the image sizing right. --- lisp/ChangeLog | 4 +++- lisp/gnus-html.el | 19 ++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 84c71c358..b68402281 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -3,6 +3,8 @@ * gnus-html.el (gnus-html-wash-tags): Don't show images that are really small. They're probably tracking images. (gnus-html-wash-tags): Remove all place holders. + (gnus-html-rescale-image): Yet another try at getting the image sizing + right. * nntp.el (nntp-request-set-mark): Refuse to do marks if nntp-marks-file-name is nil. @@ -15,7 +17,7 @@ 2010-09-01 Lars Magne Ingebrigtsen - * nndoc.el (nndoc-type-alist): Added a new type for Google digests. + * nndoc.el (nndoc-type-alist): Added a new type for Google digests. * gnus-html.el (gnus-html-wash-tags): Check the value of gnus-blocked-images in the summary buffer. diff --git a/lisp/gnus-html.el b/lisp/gnus-html.el index 6824fbf7d..7e13a0bde 100644 --- a/lisp/gnus-html.el +++ b/lisp/gnus-html.el @@ -274,14 +274,16 @@ fit these criteria." (window-height (truncate (* gnus-max-image-proportion (- (nth 3 edges) (nth 1 edges))))) scaled-image) - (or - (cond ((> height window-height) - (create-image file 'imagemagick nil - :height window-height)) - ((> width window-width) - (create-image file 'imagemagick nil - :width window-width))) - image)))) + (when (> height window-height) + (setq image (or (create-image file 'imagemagick nil + :height window-height) + image)) + (when (> (car (image-size image t)) window-width) + (setq image (or + (create-image file 'imagemagick nil + :width window-width) + image)))) + image))) (defun gnus-html-prune-cache () (let ((total-size 0) @@ -301,7 +303,6 @@ fit these criteria." (decf total-size (cadr file)) (delete-file (nth 2 file))))))) - (defun gnus-html-image-url-blocked-p (url blocked-images) "Find out if URL is blocked by BLOCKED-IMAGES." (let ((ret (and blocked-images -- 2.34.1