When applied to an 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)]
;
- or from an enclosure tag from a syndicated RSS feed:
[(#TAGS|afficher_tags{enclosure}|extraire_attribut{href}|copie_locale)]
.
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.
Note:
To apply an image filter to a remote file, it is essential to precede the reference to that file with the |copie_locale
filter.
Example:
[(#VAL{http://www.spip-contrib.net/IMG/siteon0.png}|copie_locale|image_reduire{100})]