Gnus development mailing list
 help / color / mirror / Atom feed
* controlling the size of PGP key images
@ 2013-05-28 14:02 David Edmondson
  2013-06-13  9:47 ` [PATCH] mml2015.el: Limit the size of key images inserted into articles David Edmondson
  0 siblings, 1 reply; 3+ messages in thread
From: David Edmondson @ 2013-05-28 14:02 UTC (permalink / raw)
  To: ding

[-- Attachment #1: Type: text/plain, Size: 210 bytes --]

Having the image associated with a PGP key displayed is cute, but I'd
like to control the size so that I can shrink people to teeny-tiny
size. There doesn't seem to be any support for this, unless I missed it?

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

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

* [PATCH] mml2015.el: Limit the size of key images inserted into articles
  2013-05-28 14:02 controlling the size of PGP key images David Edmondson
@ 2013-06-13  9:47 ` David Edmondson
  2013-06-14  3:06   ` Daiki Ueno
  0 siblings, 1 reply; 3+ messages in thread
From: David Edmondson @ 2013-06-13  9:47 UTC (permalink / raw)
  To: ding; +Cc: David Edmondson

* Add `mml2015-maximum-key-image-dimension', which specifies a limit
  on the width or height of any key images that are inserted into the
  article buffer.
---
 lisp/mml2015.el |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/lisp/mml2015.el b/lisp/mml2015.el
index 5d122df..67cf31d 100644
--- a/lisp/mml2015.el
+++ b/lisp/mml2015.el
@@ -146,6 +146,11 @@ If set, it overrides the setting of `mml2015-sign-with-sender'."
   :group 'mime-security
   :type 'boolean)
 
+(defcustom mml2015-maximum-key-image-dimension 64
+  "The maximum dimension (width or height) of any key images."
+  :group 'mime-security
+  :type 'integer)
+
 ;; Extract plaintext from cleartext signature.  IMO, this kind of task
 ;; should be done by GnuPG rather than Elisp, but older PGP backends
 ;; (such as Mailcrypt, and PGG) discard the output from GnuPG.
@@ -873,13 +878,18 @@ If set, it overrides the setting of `mml2015-sign-with-sender'."
         (insert (substring data 16))
         (create-image (buffer-string) nil t)))))
 
+(autoload 'gnus-rescale-image "gnus-util")
+
 (defun mml2015-epg-key-image-to-string (key-id)
   "Return a string with the image of a key, if any"
   (let* ((result "")
          (key-image (mml2015-epg-key-image key-id)))
     (when key-image
       (setq result "  ")
-      (put-text-property 1 2 'display key-image result))
+      (put-text-property 1 2 'display (gnus-rescale-image key-image
+							  (cons mml2015-maximum-key-image-dimension
+								mml2015-maximum-key-image-dimension))
+			 result))
     result))
 
 (defun mml2015-epg-signature-to-string (signature)
-- 
1.7.10.4




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

* Re: [PATCH] mml2015.el: Limit the size of key images inserted into articles
  2013-06-13  9:47 ` [PATCH] mml2015.el: Limit the size of key images inserted into articles David Edmondson
@ 2013-06-14  3:06   ` Daiki Ueno
  0 siblings, 0 replies; 3+ messages in thread
From: Daiki Ueno @ 2013-06-14  3:06 UTC (permalink / raw)
  To: David Edmondson; +Cc: ding

David Edmondson <dme@dme.org> writes:

> * Add `mml2015-maximum-key-image-dimension', which specifies a limit
>   on the width or height of any key images that are inserted into the
>   article buffer.
> ---
>  lisp/mml2015.el |   12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)

Thanks, looks good; applied (after wrapping a wrong line).

Regards,
-- 
Daiki Ueno



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

end of thread, other threads:[~2013-06-14  3:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-28 14:02 controlling the size of PGP key images David Edmondson
2013-06-13  9:47 ` [PATCH] mml2015.el: Limit the size of key images inserted into articles David Edmondson
2013-06-14  3:06   ` Daiki Ueno

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