cross
New Foswiki release 2.1.6 is available with important security fixes.
Sourceforge foswiki email lists being discontinued. Subscribe to the new Foswiki announce and discuss lists at MailingLists
This question about Using an extension: Answered

Download external pictures

If you copy and paste image from Google Docs to Foswiki (TinyMCE editor), it will be not attached (as I thought initially), but linked instead.

I would like to download all external content (all images) to appropriate topics and replace mentioned links with links to attached pictures.

Will it be possible to do that with HarvestPlugin?


Either that or ImagePlugin which can auto-attach images that you pasted into TinyMCE via the clipboard.

-- MichaelDaum - 05 Jan 2015

Thank you for prompt answer, However, I am not really sure how to use mentioned plugins to download all external sources. In ImagePlugin description, there's following information:

"If you specify a remote url using http://... the image is downloaded (using CPAN:LWP::Simple) into a local cache and then processed as usual. "

Correct me if I am wrong, but it will download image to local cache each time when user visit particular topic? What I need is to download content and no longer point to URL's on external servers.

If I am wrong - I guess you suggest to write simple bash script to replace appropriate tags (img)?

-- RomanAndrzej - 05 Jan 2015

No, images won't be downloaded repeatedly.

There are two features wrt attaching external images:

  • from an image url
  • from an inline-image inserted into the topic via the clipboard

The latter will result in an <img src="data...base64"> inline encoded images coming from the clipboard. These are then extracted and converted to proper attachments.

-- MichaelDaum - 05 Jan 2015

I don't get it... I enabled ImagePlugin. Within ImagePlugin settings, I have following options enabled:

{ImagePlugin}{RenderExternalImageLinks} {ImagePlugin}{AutoAttachExternalImages} {ImagePlugin}{AutoAttachInlineImages}

so according to what you say and help to {ImagePlugin}{AutoAttachInlineImages}:

Turn on/off automatic extraction of inline image from a topic while being saved and converting them into a proper attachment. This will affect elements such as which will be replaced by appropriate image markup configurable in {InlineImageTemplate}. Note that converting inline image data to proper attachments has got a lot of advantages, for one editing a topic text in raw format is much more convenient and performant. Keep this under consideration when disabling this flag.

I would expect that when I edit and save topic, it will be downloaded as an attachment. However, as I can see, I still have links in following format:

<img alt="" height="240px;" src="https://lh3.googleusercontent.com/verylongstring" width="413px;" />

In

{ImagePlugin}{Exclude}

I have an empty row, so why external pictures are not downloaded?

-- RomanAndrzej - 07 Jan 2015

An inline-image looks like this:

<img src="data:image/gif;base64,datadatadata">

See http://en.wikipedia.org/wiki/Data_URI_scheme

For example these are inserted as a result of copy&paste action from Word to TinyMCE.

ImagePlugin will then extrat the base64-encoded data source and make this inlined data a proper attachment.

The second feature is related to urls pointing to an external image. These too will be downloaded and attached to the current topic.

To do that just insert the http://...*png url into the topic text. Do not use the "Insert image" dialog of TinyMCE. Just use the url to it.

Even better use:

%IMAGE{"http://external-url-to-some/image.png" size="200"}%

-- MichaelDaum - 07 Jan 2015
 

QuestionForm edit

Subject Using an extension
Extension HarvestPlugin, ImagePlugin
Version Foswiki 1.1.9
Status Answered
Related Topics
Topic revision: r6 - 07 Jan 2015, MichaelDaum - This page was cached on 20 Mar 2018 - 10:48.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License