Discussion:
max-size for displayed PGP image on signed email?
Lars Ingebrigtsen
2015-01-29 03:17:47 UTC
Permalink
I like how gnus shows the image belonging to the key of a signed email,
but some people have really big heads or something and I have to scroll
a lot to get to what they actually wrote.
Is it possible to have gnus auto-resize the image to a maximum size like
70px?
That should be possible, but I can't really find what function is
showing the signed email image at all. Do you know what package it's
in?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog http://lars.ingebrigtsen.no/
Lars Ingebrigtsen
2015-01-29 08:20:11 UTC
Permalink
After some digging, it seems gnus-rescale-image returns early on some
articles because
(not (get-buffer-window (current-buffer)))
For articles where it works, current-buffer is
#<buffer *Article meh*>
For articles where it returns early, current-buffer is
#<buffer *mm-uu*-591048>
(Why does gnus-rescale-image need a current-buffer window anyway?)
That's a good question. Off the top of my head, I can't see any
particular reason for that limitation.

Anybody?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog http://lars.ingebrigtsen.no/
Kevin Brubeck Unhammer
2016-11-16 11:45:08 UTC
Permalink
Post by Lars Ingebrigtsen
After some digging, it seems gnus-rescale-image returns early on some
articles because
(not (get-buffer-window (current-buffer)))
For articles where it works, current-buffer is
#<buffer *Article meh*>
For articles where it returns early, current-buffer is
#<buffer *mm-uu*-591048>
(Why does gnus-rescale-image need a current-buffer window anyway?)
That's a good question. Off the top of my head, I can't see any
particular reason for that limitation.
Anybody?
I've been running with

(defun gnus-rescale-image (image size)
"Rescale IMAGE to SIZE if possible.
SIZE is in format (WIDTH . HEIGHT). Return a new image.
Sizes are in pixels."
(if (or (not (fboundp 'imagemagick-types))
;; (not (get-buffer-window (current-buffer)))
)
image
(let ((new-width (car size))
(new-height (cdr size)))
(when (> (cdr (image-size image t)) new-height)
(setq image (or (create-image (plist-get (cdr image) :data) 'imagemagick t
:height new-height)
image)))
(when (> (car (image-size image t)) new-width)
(setq image (or
(create-image (plist-get (cdr image) :data) 'imagemagick t
:width new-width)
image)))
image)))

for a while, and not seen any issues so far. It's been better than the
alternative so far.
Lars Ingebrigtsen
2018-04-11 17:32:04 UTC
Permalink
Post by Kevin Brubeck Unhammer
I've been running with
(defun gnus-rescale-image (image size)
"Rescale IMAGE to SIZE if possible.
SIZE is in format (WIDTH . HEIGHT). Return a new image.
Sizes are in pixels."
(if (or (not (fboundp 'imagemagick-types))
;; (not (get-buffer-window (current-buffer)))
)
I've now applied a similar fix to Emacs 27. Thanks for testing.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Gijs Hillenius
2018-04-13 06:23:28 UTC
Permalink
Post by Lars Ingebrigtsen
Post by Kevin Brubeck Unhammer
I've been running with
(defun gnus-rescale-image (image size)
"Rescale IMAGE to SIZE if possible.
SIZE is in format (WIDTH . HEIGHT). Return a new image.
Sizes are in pixels."
(if (or (not (fboundp 'imagemagick-types))
;; (not (get-buffer-window (current-buffer)))
)
I've now applied a similar fix to Emacs 27. Thanks for testing.
FWIW, this is another possibility

;; if nil, ignores images in pgp-keys
(setq mml2015-display-key-image 'nil)


Which was added to Gnus in May 2014

http://git.gnus.org/cgit/gnus.git/commit/?id=cae09469fa95d33e40ead0a2dcff45f815c275ce
--
A visit to a strange place will bring fresh work.
Loading...