Support the ongoing development of Laravel.io →
Requests Input Views
Last updated 2 years ago.
0

Nope. You can only serve images from with the served domain, such as http://localhost/image.jpg

0

Not unless you serve the file through a PHP script or something (see xSendFile)

0

Yep. Though I'm pretty sure that wasn't what the OP was asking!

0

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.

Last updated 9 years ago.
0

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.

Last updated 9 years ago.
0

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]);
}
Last updated 9 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.