(require 'dom)
(require 'seq)
(require 'svg)
+(require 'image)
(defgroup shr nil
"Simple HTML Renderer"
If called twice, then try to fetch the URL and see whether it
redirects somewhere else."
(interactive "P")
- (let ((url (or (get-text-property (point) 'shr-url)
- (get-text-property (point) 'image-url))))
+ (let ((url (if image-url
+ (get-text-property (point) 'image-url)
+ (or (get-text-property (point) 'shr-url)
+ (get-text-property (point) 'image-url)))))
(cond
((not url)
(message "No URL under point"))
(max-width (truncate (* shr-max-image-proportion
(- (nth 2 edges) (nth 0 edges)))))
(max-height (truncate (* shr-max-image-proportion
- (- (nth 3 edges) (nth 1 edges))))))
+ (- (nth 3 edges) (nth 1 edges)))))
+ (scaling (image-compute-scaling-factor image-scaling-factor)))
(when (or (and width
(> width max-width))
(and height
(> height max-height)))
(setq width nil
height nil))
- (if (and width height)
+ (if (and width height
+ (< (* width scaling) max-width)
+ (< (* height scaling) max-height))
(create-image
data 'imagemagick t
:ascent 100