You are here

function remote_stream_wrapper_file_load_by_uri in Remote Stream Wrapper 7

Load a file object by URI.

Parameters

string $uri: A string containing the URI, path, or filename.

Return value

A file object, or FALSE if not found.

3 calls to remote_stream_wrapper_file_load_by_uri()
RemoteStreamWrapperTestCase::testFileCrud in ./remote_stream_wrapper.test
Test file CRUD functions with remote files.
remote_stream_wrapper_file_add_form_submit in ./remote_stream_wrapper.module
Save a file record based on a remote URL.
remote_stream_wrapper_image_style_deliver in ./remote_stream_wrapper.image.inc
Copy of image_style_deliver() for use with remote images.

File

./remote_stream_wrapper.module, line 178
Provides a remote stream wrapper and file field integration.

Code

function remote_stream_wrapper_file_load_by_uri($uri) {
  $uri = file_stream_wrapper_uri_normalize($uri);
  $files = entity_load('file', FALSE, array(
    'uri' => $uri,
  ));
  return !empty($files) ? reset($files) : FALSE;
}