Skip to content

Commit

Permalink
Use find-image to find the actual location of the image file in image…
Browse files Browse the repository at this point in the history
…-load-path.
  • Loading branch information
hniksic committed Sep 17, 2012
1 parent 58775c8 commit 3ed76d8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions htmlize.el
Expand Up @@ -451,9 +451,12 @@ next-single-char-property-change")))

(defun htmlize-generate-image (imgprops)
(cond ((plist-get imgprops :file)
(format "<img src=\"%s\" />"
(htmlize-protect-string (file-relative-name
(plist-get imgprops :file)))))
;; Try to find the image in image-load-path
(let* ((found-props (cdr (find-image (list imgprops))))
(file (or (plist-get found-props :file)
(plist-get imgprops :file))))
(format "<img src=\"%s\" />"
(htmlize-protect-string (file-relative-name file)))))
((plist-get imgprops :data)
(format "<img src=\"data:image/%s;base64,%s\" />"
(or (plist-get imgprops :type) "")
Expand Down

0 comments on commit 3ed76d8

Please sign in to comment.