As I understand it, files that Drupal knows about are referred to as managed files. Every managed file has a unique ID. Unlike a stream wrapper, this unique File ID will never change. For truly portable file paths, it might be better to use the File ID instead, which can be extrapolated into an absolute or relative path for display.

Essentially, providing an input format like [file:fid]. The user would never have to write this manually, since you convert to and from it for them automatically, much like you are now with the stream wrapper. But it has the advantage of always being able to point to the most recent location of the file, even if it gets moved.

Comments

solotandem’s picture

That makes sense, as you mention, even in the event the file is moved. Thanks.

funkym’s picture

I've been playing around with this concept in one of my github repos, it seems to be working fairly well but probably still needs some work.

https://github.com/mpezzi/file_filter

I'd be happy to help port over some of this functionality into one central project and I think this would work nicely in conjunction with the Insert module.

mrfelton’s picture

This looks really good @funkym. I'll give it a try tomorrow if I get a chance. One thing I had been pondering, was wether it would make sense to somehow piggy back off what the media module does with it's input filter. Or wether this functionality should actually be part of media module.

BManuel’s picture

Please don't add this to media, I think it is best as a stand alone so that way we can use across many editor and other image handling modules. Any eta on the fid idea?
Thanks.
BM

solotandem’s picture

Assigned: Unassigned » solotandem
Status: Active » Fixed

Added in these commits:
- commit 1
- commit 2.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.