From: Kevin Brubeck Unhammer <unhammer@fsfe.org>
To: info-gnus-english@gnu.org
Subject: Re: max-size for displayed PGP image on signed email?
Date: Wed, 16 Nov 2016 12:45:08 +0100 [thread overview]
Message-ID: <87bmxfd4xn.fsf@fsfe.org> (raw)
In-Reply-To: <8761bq3sn8.fsf@building.gnus.org>
[-- Attachment #1.1: Type: text/plain, Size: 1593 bytes --]
Lars Ingebrigtsen <larsi@gnus.org> čálii:
> Kevin Brubeck Unhammer <unhammer@fsfe.org> writes:
>
>> 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.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]
next prev parent reply other threads:[~2016-11-16 11:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.17523.1420806804.1147.info-gnus-english@gnu.org>
2015-01-29 3:17 ` Lars Ingebrigtsen
2015-01-29 8:13 ` Kevin Brubeck Unhammer
2015-01-29 8:20 ` Lars Ingebrigtsen
2016-11-16 11:45 ` Kevin Brubeck Unhammer [this message]
2018-04-11 17:32 ` Lars Ingebrigtsen
[not found] ` <mailman.12051.1523467941.27995.info-gnus-english@gnu.org>
2018-04-13 6:23 ` Gijs Hillenius
2015-01-09 12:29 Kevin Brubeck Unhammer
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=87bmxfd4xn.fsf@fsfe.org \
--to=unhammer@fsfe.org \
--cc=info-gnus-english@gnu.org \
/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: link
Be 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 NNTP newsgroup(s).