The |copie_locale filter creates a local copy of a remote file (image, text, pdf, html,...) originating from another web domain.

When applied to a URL, this filter attempts to copy the file to which the URL is pointing, and then, if that operation completes successfully, it will return the relative URL of the local copy of the file (e.g. "IMG/distant/jpg/l_image.jpg"). If the copy operation fails, the filter will return nothing.

The URL for the file that you want to copy can be
-  either specified explicitly:
  [(#VAL{remote_file_url}|copie_locale)] ;
-  or from an external table:
  [(#REMOTE_FILE_URL|copie_locale)] ;
-  of from an enclosure tag from a syndicated RSS feed:

Updating the local copy

The filter accepts an optional argument: |copie_locale{mode} which can take 4 possible values.
-  auto (by default):
in this case, a local copy of the remote file is made into the IMG/distant/ directory. This copy is only performed once. It is not updated upon recalculation of the page if the remote file is updated and its URL remains identical.
-  force:
the local copy is performed upon each recalculation of the page. The local file might therefore be possibly updated (to be used with caution, since this function can use up considerable machine resources).
-  modif:
the local copy already present will only be updated if it is subsequent to the "If-Modified-Since" header of the original file.
-  test:
the filter only checks if there is already a local copy of the file nominated by the URL, and if so then returns the URL of that copy. Otherwise, it will return nothing.


To apply an image filter to a remote file, it is essential to precede the reference to that file with the |copie_locale filter.


Author Mark Published : Updated : 26/10/12

Translations : català, English, français, Nederlands