DeuxHuitHuit / image_upload

Image upload field for Symphony CMS 2.x
http://symphonyextensions.com/extensions/image_upload/
MIT License
10 stars 8 forks source link

Remote Images #30

Open nilshoerrmann opened 9 years ago

nilshoerrmann commented 9 years ago

This is a feature request: Would it be possible to make this field handle remote images? Sounds strange? Okay …

The Background

We have a site that grabs Facebook feeds and imports entries using XML Importer. Due to the way Facebook handles their media attachments, links to images change after a while which results invalid references in our imported entries. If we could store a copy on our own server, everything would continue to work as expected.

The Idea

If the extension receives a link to a remote ressource instead of a local image, it first stores a copy on the server and then continues as usual.

nitriques commented 9 years ago

I like that.

A "from url" option would do the trick.... Do you have ideas UI-wise ?

nilshoerrmann commented 9 years ago

I'm not sure if a UI is a good idea because this niche feature would bloat the interface visually. If an UI is desired, I'd stick to something simple similar to Google's image search: a tab switch between a file input and a text input.

But I really thought of this as a UI-less feature: something documented that works under the hood but isn't exposed in the backend itself. The reason behind this is that the primary function of this extension is managing local files and my request is just about making files local in case they are hosted externally.

nitriques commented 9 years ago

Ok great, thanks for sharing your ideas.

I would definitivly make the remote image local (so the only difference would be the first time). But I wonder how to expose this to user... and I think we should be able to disable it on a per field basis.

How would it work if there are no UI ?

nilshoerrmann commented 9 years ago

Quite simple: if the POST data contains a remote file, the field copies it first to the specified local folder and then proceeds as usual. Nothing else.

This'll make remote files work with any kind of field import (custom ones as well as XML Importers) and it'll allow other extensions to add a special UI for remote files on top of the default one using JavaScript if needed without bloating this field's UI. Thus, the normal user wouldn't notice anything at all, it would be an advanced feature.

nitriques commented 9 years ago

Ok but how do I input the remote file's url ? Only via code ?

nilshoerrmann commented 9 years ago

Using "a third party", either a custum script or extension, yes.

nitriques commented 9 years ago

Ah now I get it. Yeah, support would be easy to add. But I feel like I'd still like a UI for that (but as I said, it must be opt-in)