Function: shr-zoom-image
shr-zoom-image is an interactive and byte-compiled function defined in
shr.el.gz.
Signature
(shr-zoom-image &optional POSITION ZOOM-LEVEL)
Documentation
Change the zoom level of the image at POSITION.
The size will cycle through the default size, the original size, and full-buffer size.
Probably introduced at or before Emacs version 31.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/net/shr.el.gz
(defun shr-zoom-image (&optional position zoom-level)
"Change the zoom level of the image at POSITION.
The size will cycle through the default size, the original size, and
full-buffer size."
(interactive "d")
(unless position (setq position (point)))
(let ((url (get-text-property position 'image-url)))
(if (not url)
(message "No image under point")
(unless zoom-level
(let ((last-zoom (get-text-property position 'image-zoom)))
(setq zoom-level (or (cadr (memq last-zoom shr-image-zoom-levels))
(car shr-image-zoom-levels)))))
(let* ((end (or (next-single-property-change position 'image-url)
(point-max)))
(start (or (previous-single-property-change end 'image-url)
(point-min)))
(dom-size (get-text-property position 'image-dom-size))
(flags `( :zoom ,zoom-level
:width ,(car dom-size)
:height ,(cdr dom-size)))
(buffer-read-only nil))
;; Delete the old picture.
(put-text-property start end 'display nil)
(message "%s" (cadr (assq zoom-level shr-image-zoom-level-alist)))
(if (and (not shr-ignore-cache)
(url-is-cached url))
(shr-replace-image (shr-get-image-data url) start
(set-marker (make-marker) end) flags)
(url-retrieve url #'shr-image-fetched
`(,(current-buffer) ,start
,(set-marker (make-marker) end)
,flags)
t))))))