Not unless you serve the file through a PHP script or something (see xSendFile)
Hi you could try using this aproximation:
Step 1. Creates one helper file called file.php with the following content:
$file = "/path/to/private/folder/{$_GET['f']}";
if(file_exists($file)) {
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$mime = finfo_file($finfo, $file);
finfo_close($finfo);
header("Content-Type: $mime");
readfile($file);
}
Step 2. Next within your blade or php views you could use the next links:
<img src='file.php?f=yourimage.png'>
//For other filetype
<a href='file.php?f=document.pdf'>Download your PDF File</a>
Maybe you could use a custom Laravel Response for some other case.
Hope it helps you.
In Laravel 5.0 file system are abstracted and you can even access resource from the cloud still using the same API!
Please see the docs: Filesystem / Cloud Storage.
Yea and no I guess? I guess that's not really OP's really looking for...but, just another way ... :D Pull [base64_code] from database, or private location.
<img src="data:image/png;base64,[base64_code]" />
OR
div.my-image {
width: 300px;
height: 300px;
background-image:url(data:image/png;base64,[base64_code]);
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community