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
Comment #1
solotandem CreditAttribution: solotandem commentedThat makes sense, as you mention, even in the event the file is moved. Thanks.
Comment #2
funkym CreditAttribution: funkym commentedI'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.
Comment #3
mrfelton CreditAttribution: mrfelton commentedThis 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.
Comment #4
BManuel CreditAttribution: BManuel commentedPlease 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
Comment #5
solotandem CreditAttribution: solotandem commentedAdded in these commits:
- commit 1
- commit 2.