TorstenThis looks like a nice feature!
Maybe you could add to save the address and date the picture was taken, thus, one could easily refer to the image origin. That is sometimes of importance.Thanks for sharing
On 16 October 2013 12:04, Oleh <ohwoeowho@gmail.com> wrote:
Hi all,Here's a little hack that I use to make my life easier:(require 'async)(eval-when-compile(require 'cl))(defun org-store-image (link basedir)(async-start`(lambda() (shell-command,(format "wget \"%s\" -P \"%s\""link(expand-file-name basedir))))(lexical-let ((cur-buf (current-buffer)))(lambda(x)(with-current-buffer cur-buf(org-display-inline-images))))))(defun org-store-image-clipboard (link)"Save image at address LINK to current directory's subdirectory DIR.DIR is the name of the current level 0 heading."(interactive (list (current-kill 0)))(let ((filename (car (last (split-string link "/"))))(dir (save-excursion(org-up-heading-all (1- (org-current-level)))(substring-no-properties(org-get-heading)))))(if (null (image-type-from-file-name filename))(message "not an image URL")(unless (file-exists-p (expand-file-name filename dir))(org-store-image link dir))(insert (format "[[./%s/%s]]" dir filename))(org-display-inline-images))))(setcdr (assoc "^\\(https?\\|ftp\\|file\\|nfs\\)://" dnd-protocol-alist) 'dnd-org-insert)(defun dnd-org-insert (uri action)(org-store-image-clipboard uri))When it's a plain image, I can just drag it from the browser to org-mode.It will be downloaded in async to a subdirectory of the current directory and the link will be insertedat point.For stubborn images that are links I can right click to copy image location and call`org-store-image-clipboard' interactively.I hope it's useful to someone and that I'm not re-implementing standard functionality.regards,Olehregards,Oleh