Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* Re: max-size for displayed PGP image on signed email?
       [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
  0 siblings, 1 reply; 7+ messages in thread
From: Lars Ingebrigtsen @ 2015-01-29  3:17 UTC (permalink / raw)
  To: Kevin Brubeck Unhammer; +Cc: info-gnus-english

Kevin Brubeck Unhammer <unhammer@fsfe.org> writes:

> 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/


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: max-size for displayed PGP image on signed email?
  2015-01-29  3:17 ` max-size for displayed PGP image on signed email? Lars Ingebrigtsen
@ 2015-01-29  8:13   ` Kevin Brubeck Unhammer
  2015-01-29  8:20     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 7+ messages in thread
From: Kevin Brubeck Unhammer @ 2015-01-29  8:13 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: info-gnus-english


[-- Attachment #1.1: Type: text/plain, Size: 1237 bytes --]

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Kevin Brubeck Unhammer <unhammer@fsfe.org> writes:
>
>> 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?

Resizing already seems to be happening in
mml2015-epg-key-image-to-string according to
mml2015-maximum-key-image-dimension, but now I see there are just some
emails where the resizing doesn't happen (even though the function is
called, and the signer is the same).

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?)


-- 
Kevin Brubeck Unhammer

GPG: 0x766AC60C

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: max-size for displayed PGP image on signed email?
  2015-01-29  8:13   ` Kevin Brubeck Unhammer
@ 2015-01-29  8:20     ` Lars Ingebrigtsen
  2016-11-16 11:45       ` Kevin Brubeck Unhammer
  0 siblings, 1 reply; 7+ messages in thread
From: Lars Ingebrigtsen @ 2015-01-29  8:20 UTC (permalink / raw)
  To: Kevin Brubeck Unhammer; +Cc: info-gnus-english

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?

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: max-size for displayed PGP image on signed email?
  2015-01-29  8:20     ` Lars Ingebrigtsen
@ 2016-11-16 11:45       ` Kevin Brubeck Unhammer
  2018-04-11 17:32         ` Lars Ingebrigtsen
       [not found]         ` <mailman.12051.1523467941.27995.info-gnus-english@gnu.org>
  0 siblings, 2 replies; 7+ messages in thread
From: Kevin Brubeck Unhammer @ 2016-11-16 11:45 UTC (permalink / raw)
  To: info-gnus-english


[-- 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 --]



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: max-size for displayed PGP image on signed email?
  2016-11-16 11:45       ` Kevin Brubeck Unhammer
@ 2018-04-11 17:32         ` Lars Ingebrigtsen
       [not found]         ` <mailman.12051.1523467941.27995.info-gnus-english@gnu.org>
  1 sibling, 0 replies; 7+ messages in thread
From: Lars Ingebrigtsen @ 2018-04-11 17:32 UTC (permalink / raw)
  To: Kevin Brubeck Unhammer; +Cc: info-gnus-english

Kevin Brubeck Unhammer <unhammer@fsfe.org> writes:

> 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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: max-size for displayed PGP image on signed email?
       [not found]         ` <mailman.12051.1523467941.27995.info-gnus-english@gnu.org>
@ 2018-04-13  6:23           ` Gijs Hillenius
  0 siblings, 0 replies; 7+ messages in thread
From: Gijs Hillenius @ 2018-04-13  6:23 UTC (permalink / raw)
  To: Kevin Brubeck Unhammer, info-gnus-english; +Cc: Lars Ingebrigtsen

On 11 Apr 2018, Lars Ingebrigtsen wrote:

> Kevin Brubeck Unhammer <unhammer@fsfe.org> writes:
>
>> 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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* max-size for displayed PGP image on signed email?
@ 2015-01-09 12:29 Kevin Brubeck Unhammer
  0 siblings, 0 replies; 7+ messages in thread
From: Kevin Brubeck Unhammer @ 2015-01-09 12:29 UTC (permalink / raw)
  To: info-gnus-english


[-- Attachment #1.1: Type: text/plain, Size: 346 bytes --]

Hi fellow gnusers,

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?


-- 
Kevin Brubeck Unhammer

GPG: 0x766AC60C

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-04-13  6:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <mailman.17523.1420806804.1147.info-gnus-english@gnu.org>
2015-01-29  3:17 ` max-size for displayed PGP image on signed email? 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
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

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).