#4029 - SERVE_LOCALLY symbol (to serve self cached versions of third party hosted URLs)

Identifier #4029
Issue type Feature request or suggestion
Title SERVE_LOCALLY symbol (to serve self cached versions of third party hosted URLs)
Status Closed (duplicate)
Handling member Chris Graham
Addon core
Description Add a new Tempcode symbol, SERVE_LOCALLY. The purpose is a way to copy remote URLs locally using Tempcode, and serve them locally (maybe for speed, maybe to avoid hammering someone else's server, maybe as an automatic backup). You pass it a URL and the first time it runs it copies that URL to a local file using an algorithmicly-defined filename (i.e. if the local file does not exist yet). A second optional parameter would force a particular file extension (as we have no other way of replicating the original mime-type if we are just serving on-disk files with no database data).

E.g.

{$SERVE_LOCALLY,http://example.com/some-video,mp4}

This example would download the file at "http://example.com/some-video" and save it in something like "uploads/localised_remote_urls/some-video.mp4". In this example the URL has no file extension, so I am forcing one so I know it will have the correct mime type served by Apache.

The symbol would most likely be used in catalogue templates, when people enter URLs to media.
Steps to reproduce

Related to

#3854 - Auto-tracked/proxied linking via Tempcode

Funded? No
The system will post a comment when this issue is modified (e.g., status changes). To be notified of this, click "Enable comment notifications".

Rating

Unrated