Accessing Images to show in Blade Outside the public folder in laravel - laravel-5

I have some images in storage/app/uploads which i want to show on front end. Let Say blade file. But we have acces to public folder only in laravel and images ar in storage folder as i mentioned above so how i couls acces it so i colud set the src='?' in image tag to see image.

Related

Problem showing an image in a laravel website

I save images in a controller with the $imagePath = "/upload/images/{$adver} address. Then these images are saved in a public folder in the root folder, but when I move these images file into the C-Panel I can't see them.
The address of an image is saved in advertise table and the images are saved in the public folder. I use src="advertise.image1" to show an image.
The images are in a database and I get the route to database to show them on the website.
Are you using the public_path helper function?
$imagePath = public_path("/upload/images/{$adver}");
You may have issues with your public path if you're saying they're not working on the remote location. Is your remote public path set as public_html rather than public?

Vuejs public folder vs laravel storage/app/public to store images

I am trying to store images in project/public/imgs folder but laravel always store images in project/storage/app/public/imgs.
I am using Vuejs with laravel so, i have to store images in the above mentioned folder. i have make changes in config/filesysytem.php but it does not work.
please tell me where i am wrong. here are two screenshots of my changes.
Project structure:
https://gyazo.com/f5126911583b7ac6c27cff4f58802975
Config/Filesystem.php:
https://gyazo.com/290ae9b3ccce640c8b9c06aac5346706

Laravel api call should return image url

I created a little API using Laravel, my doubt is where I should locate the images in the project and given a concrete API call how I return a URL to an image stored in my project?
You should return your image path like:
First things is retrieve/static located the images folder path in the project.And then retrieve name of image from database using query. Finally Concatenating name of image which is stored in DB.
http://yourSite.com/folderPath.$imageName
Because when upload images, We have added only name of images not full URL.

Cannot save and access images (Laravel)

I am having a problem with accessing images.
I can upload and receive an image to the database no problem; however, I have my images manually saved under the public/avatar folder and I can retrieve the images from that location by using:
{{ asset('/uploads/avatars/image.jpg }}
I cannot figure out how to save to that location; I've tried the following to no avail:
Storage::disk('local')->put('/uploads/avatars/', $image);
Also, when I try to save from the controller it saves everything in storage/app/public, but I don't know how to access the image files from the model nor how to save them somewhere else.
When you use this
Storage::disk('local')->put('/uploads/avatars/', $image);
then all of your images are store in storage/app/uploads/avatars directory. so you can not access it from public directory. If you want to access it from public directory, you have to make a symbolic link of storage/app/uploads/avatars in public directory. I think it work fine :)

how and where can store images with laravel?

how and where I can store images using laravel?
context:
I want display some images in my main view (these are predefined by me).
I also want to store images uploaded by users, however, do not know where to store these images.
I'd like to call these from the view...
Thank you very much for the help. :)
Basically you can save your files wherever you want within your Laravel application provided that you have permissions to create directory and file.
But I prefer saving files in the storage/app folder. Laravel provides a simple API to manipulate files on disk. See the docs.
Update:
This answer was posted when Laravel was in version 5.2.
From version 5.3 on, you can easily create symbolic links by running the artisan command php artisan storage:link. See the docs.
Make directory for images in myapp/public/images and keep images on there.
<img src="{{URL('/images/logo.jpg')}}">
If you want to display them on your site store them in your public directory. Since they are uploaded by users you will need to pass them through a form. Here is an example of a controller.
$file = Input::file('picture');
$file->move(public_path().'/images/',$user->id.'.jpg');
The user will submit a form with a picture field. The two lines above will store it in the public directory in an images folder, with the relevant user's id as its name. Your probably best off making a model in your database for images and their paths. If you do, add these lines after the two above.
$image = new Image;
$image->path='/images/'.$user->id.'.jpg';
$image->user_id = $user->id;
$image->save();
To display it in the view simply set an $image variable to the correct image model in your controller and pass it to the view. Then pop its path in the src of the image.
<img src={{$image->path}} alt={{$image->path}}>

Resources