aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-media.el
diff options
context:
space:
mode:
authormousebot <mousebot@riseup.net>2021-10-20 15:10:12 +0200
committermousebot <mousebot@riseup.net>2021-10-20 15:10:12 +0200
commit636367b43d3f4ff1f6362a5e7e47016fc2a69d89 (patch)
treed2b538d10857ed0494baabfbf4466355b4889c03 /lisp/mastodon-media.el
parent7bcf78751c7e0f8ac6d5ad03be8e87e8ed30f9a3 (diff)
parente0cabe76d4107610c44b1bc6c570840ebadb5467 (diff)
Merge branch 'img-previews' into develop
Diffstat (limited to 'lisp/mastodon-media.el')
-rw-r--r--lisp/mastodon-media.el11
1 files changed, 9 insertions, 2 deletions
diff --git a/lisp/mastodon-media.el b/lisp/mastodon-media.el
index b58eab6..3016d33 100644
--- a/lisp/mastodon-media.el
+++ b/lisp/mastodon-media.el
@@ -47,7 +47,12 @@
:type 'integer)
(defcustom mastodon-media--preview-max-height 250
- "Max height of any media attachment preview to be shown."
+ "Max height of any media attachment preview to be shown in timelines."
+ :group 'mastodon-media
+ :type 'integer)
+
+(defcustom mastodon-media--attachment-height 80
+ "Height of the attached images preview in the toot draft buffer."
:group 'mastodon-media
:type 'integer)
@@ -130,7 +135,7 @@ fKRJkmVZjAQwh78A6vCRWJE8K+8AAAAASUVORK5CYII=")
"The PNG data for a generic 200x200 'broken image' view.")
(defun mastodon-media--process-image-response
- (status-plist marker image-options region-length)
+ (status-plist marker image-options region-length url)
"Callback function processing the url retrieve response for URL.
STATUS-PLIST is the usual plist of status events as per `url-retrieve'.
@@ -151,6 +156,8 @@ REGION-LENGTH is the length of the region that should be replaced with the image
(when image-options 'imagemagick)
nil) ; inbuilt scaling in 27.1
t image-options))))
+ (unless (url-is-cached url) ; cache image if not already cached
+ (url-store-in-cache url-buffer))
(with-current-buffer (marker-buffer marker)
;; Save narrowing in our buffer
(let ((inhibit-read-only t))