From: Oleh <ohwoeowho@gmail.com>
To: Xebar Saram <zeltakc@gmail.com>
Cc: org mode <emacs-orgmode@gnu.org>
Subject: Re: Drag images from Firefox to org-mode
Date: Wed, 16 Oct 2013 17:52:51 +0200 [thread overview]
Message-ID: <CAA01p3rjrNbBYvAkc--5DCZVFDMBSbSM+9cycJkd9LLE34xs7Q@mail.gmail.com> (raw)
In-Reply-To: <CAOQHXPpJV0Am0BFmz=aAgbuTkiyQGNeKum68spV4JwV8DT4o9A@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 4010 bytes --]
The address and date are auto-added as a comment now.
The updated source can be found at https://github.com/abo-abo/org-download
Images can be stored in a custom dir with:
(setq org-download-image-dir "~/Pictures/org")
I still want to add some rescaling option via ImageMagick and
an option for local files.
Other suggestions can be raised as issues on github, so it's
easier to keep track of them.
regards,
Oleh
On Wed, Oct 16, 2013 at 4:22 PM, Xebar Saram <zeltakc@gmail.com> wrote:
> Thx Oleh ,This is really amazing!
>
> Ive been waiting for ages for something like this. a few questions (well
> ok "requests" :)..) if you dont mind. please bare in mind i have zero
> coding skills (or understanding so my questions may be stupid :))
>
> 1.i use alot of images and :in alot of headings and sub headings and the
> current method creates tens of folders. can you make an option to store all
> images in a central location, IE ~/org/images? also Torstens suggestion
> of adding a date to the file name makes alot of sense :)
>
> 2.can you add an option to add a local file (IE drag a jpg/png from a
> folder) or even better yet build into the script a screenshot ability
> function (using scrot etc) like in the following script:
>
> http://lists.gnu.org/archive/html/emacs-orgmode/2013-05/msg00873.html
>
>
> 3.maybe perhaps a text scraper that would do the same for formatted text,
> so one would mark a section in the browser, and drag it into org (and the
> script would automagicly would get rid of the html yuckyness << notice my
> highly technical coding terms and knowledge)
>
> best and thanks alot!
>
> Z
>
>
> On Wed, Oct 16, 2013 at 4:48 PM, Torsten Wagner <torsten.wagner@gmail.com>wrote:
>
>> This 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
>>
>> Torsten
>>
>>
>>
>> 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 inserted
>>> at 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,
>>> Oleh
>>>
>>> regards,
>>> Oleh
>>>
>>
>>
>
[-- Attachment #2: Type: text/html, Size: 6581 bytes --]
next prev parent reply other threads:[~2013-10-16 15:53 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-16 10:04 Drag images from Firefox to org-mode Oleh
2013-10-16 13:48 ` Torsten Wagner
2013-10-16 14:22 ` Xebar Saram
2013-10-16 15:52 ` Oleh [this message]
2013-10-16 17:28 ` Marcin Borkowski
2013-10-17 11:49 ` Samuel Loury
2013-10-17 3:42 ` Eric Abrahamsen
2013-10-17 12:04 ` Carsten Dominik
2013-10-17 12:43 ` Nicolas Richard
2013-10-17 14:04 ` Rick Frankel
2013-10-17 14:48 ` Nicolas Richard
2013-10-17 16:51 ` Rick Frankel
2013-10-18 5:29 ` Nicolas Richard
2013-10-18 14:44 ` Rick Frankel
2013-10-18 15:39 ` Nicolas Richard
2013-10-18 9:24 ` Oleh
2013-10-18 9:28 ` Carsten Dominik
2013-10-18 9:33 ` Oleh
2013-10-18 9:47 ` Nicolas Richard
2013-10-18 10:04 ` Oleh
2013-10-18 10:23 ` Nicolas Richard
[not found] ` <CAA01p3obTUXshcS-m=iB2KOADAx9eNpj8PK_F5O1x5dLtCobcA@mail.gmail.com>
2013-10-18 11:00 ` Nicolas Richard
2013-10-18 11:06 ` Oleh
2013-10-18 15:03 ` Rick Frankel
2013-10-18 15:36 ` Nicolas Richard
2013-10-18 15:44 ` Rick Frankel
2013-10-18 18:24 ` Rick Frankel
2013-10-18 19:22 ` Oleh
2013-10-18 20:45 ` Rick Frankel
2013-10-19 10:34 ` Oleh
2013-10-20 20:42 ` Nicolas Richard
2013-10-21 7:24 ` Oleh
2013-10-23 17:13 ` Rick Frankel
2013-10-23 18:26 ` Oleh
2013-10-23 18:59 ` Torsten Wagner
2013-10-23 20:01 ` Torsten Wagner
2013-10-24 6:47 ` Christian Moe
2014-01-04 15:01 ` Oleh
2014-01-04 15:17 ` Bastien
2013-10-18 10:44 ` Nicolas Richard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAA01p3rjrNbBYvAkc--5DCZVFDMBSbSM+9cycJkd9LLE34xs7Q@mail.gmail.com \
--to=ohwoeowho@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=zeltakc@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).