On-the-fly remote image fetching
I've got a tricky problem, and I'm hoping folks more familiar with the CCK/Views ecosystem can help me formulate a plan of attack.
My module pulls listings from a remote database of real estate listings and imports them as nodes, with each field in the remote listing corresponding to a CCK field on the nodes, so the listings can easily be displayed, sorted and filtered with Views - it works pretty well. Each listing can also have several images, and I'd like to be able to use CCK and Views to display those images as well with full ImageCache magic.
"So use ImageField/FileField!" you say. "Why even bother posting about this?" Well, here's the trick; we're potentially talking about over ten thousand listings here, and each listing can potentially have dozens of images, and there's no guarantee any particular listing will ever even be seen before it is deleted. So importing all those images along with the listings themselves is impractical. Instead, I've built a system which fetches and caches the images locally as they're requested, so the burden of downloading all those images is spread out over time, and if a node is never viewed, its images are never downloaded; this is simply triggered in hook_view(), outside of CCK. This works fairly well, but…
There doesn't seem to be a way to use ImageField/FileField to attach images to a node which don't actually physically exist on the disk (or in {files}) yet. I would like this functionality, but being a programmer and therefore inherently lazy, I'd like to avoid duplicating as much work as possible, and stay within the CCK/Views framework as much as possible (I'd like to avoid silly hacks). I'm hoping for a bit of advice on how to attack this problem from someone wiser than me. Am I really going to have to create a whole new CCK field and the code to display it via Views, or can I build upon what's already there?
(Aside: If someone were to write a full dead-tree book about coding for CCK/D7 fields and Views (and I'm sure a full book could be written about it), I'd buy it in an instant. Even if it were published by Packt with their crap typography.)
