function remote_stream_wrapper_file_create_by_uri in Remote Stream Wrapper 7
Helper functon to assemble a new file entity object by URI.
Parameters
string $uri: A string containing the URI, path, or filename.
3 calls to remote_stream_wrapper_file_create_by_uri()
- RemoteStreamWrapperTestCase::testFileCrud in ./
remote_stream_wrapper.test - Test file CRUD functions with remote files.
- RemoteStreamWrapperTestCase::testRemoteImageStyles in ./
remote_stream_wrapper.test - Test that remote images can be used with image styles.
- remote_stream_wrapper_file_add_form_submit in ./
remote_stream_wrapper.module - Save a file record based on a remote URL.
File
- ./
remote_stream_wrapper.module, line 190 - Provides a remote stream wrapper and file field integration.
Code
function remote_stream_wrapper_file_create_by_uri($uri) {
$uri = file_stream_wrapper_uri_normalize($uri);
$file = new stdClass();
$file->fid = NULL;
$file->uri = $uri;
$file->filename = basename($file->uri);
$file->filemime = file_get_mimetype($file->uri);
$file->uid = $GLOBALS['user']->uid;
$file->status = FILE_STATUS_PERMANENT;
return $file;
}