info-gnus-english
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: max-size for displayed PGP image on signed email?


From: Kevin Brubeck Unhammer
Subject: Re: max-size for displayed PGP image on signed email?
Date: Wed, 16 Nov 2016 12:45:08 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

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: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]