I need to retrieve the node id of my uploaded files whose Bitcache fingerprints are stored in my file repository (sites/all/files/bitcache/file).
I have been trying to use the Bitcache functions noted in the documentation, however they are not giving me anything useful, so I must be using them incorrectly. Can I get some help on figuring out the NID for any fingerprint stored in the file repository?
For example:
$uri = "bitcache://a0f1d4b7b8471897cfe8ee368a21dbcf9617b7f8";
// uploaded file in bitcache/file/
$url = bitcache_resolve_uri($uri);
// produces: http://example.com/bitcache/a0f1d4b7b8471897cfe8ee368a21dbcf9617b7f8
// I expected a path to the file referenced by the fingerprint data, but that URI = 404
$bid = bitcache_uri_to_id($url);
// produces nothing
// I expected to receive a NID or something similar
$bdata = file_get_contents($url);
// produces nothing, although the file actually contains significant content
// I expected binary output, as this sample is a PDF file
Thank you for any guidance on using Bitcache functions.
Comments
Comment #1
Stupidscript commentedComment #2
Stupidscript commentedHere's how I did it:
.htaccess file in the 'file' directory grabs all requests and redirects to a PHP file containing this script segment:
Which gives me the two things I need for my links: the title and the url_alias:
The query relationships that get me there are:
Tweaks welcome.
[Leaving open so others can find it. Close it, if you want to.]