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

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

Related

What is the best place for uploading files when spilt frontend and backend?

hi i working to spilt backend (laravel) and frontend(nuxt.js)
and i want to know best place to upload dynamic images or files on the.
backend (laravel): public folder.
or
frontend (nuxtjs): asstes/images folder.
and i want when i finished my project upload it on same server with different port.
thank you
If those are static files used in the frontend, then in the assets/images from nuxtjs.
If those are files uploaded to the server, then in the laravel backend.

Storage laravel. Is this secure to keep private image?

Hi i'm working on sell picture project. I want to secure image in public folder . I follow this way How to protect image from public view in Laravel 5?
Everything work fine. I just want to make sure in storage Path thier is no way to access with URL right? I put my image into storage/images not storage/app/public
If i storage link it will be effect to my private image or not thanks
In Laravel the root of the webserver is the public directory and the entrypoint is public/index.php.
This means that you can access via web server everything under public directory (like javascript/css files and image assets).
The storage directory is one level up and there is no way to access it.
In the discussion you mention the url http://www.somedomainname.net/images/users/userImage.jpg refers to the file userImage.jpg under /your/document/root/laravel/app/public/images/users by default, so the storage directory is not even read.
Laravel, though, will let you link the storage/app/public directory inside the public/storage directory, using the command php artisan storage:link, but that's it.

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

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.

Storing images in storage folder of laravel, and fetching it by a http request is not working

I have deployed laravel application in heroku. I am storing images in storage folder of laravel and trying to fetch it by defining a route. It was working well on local, but when i trying to do the same on server, then its not showing the images. I thought that storage folder is inside the laravel, so it should work fine, but its not working.
Can i store images in public folder by creating a named folder "gallery" inside that and put that gallery folder in gitignore. so will the gitignore folder be vanished when i will push the laravel project again?
Other options are using another file system. Most of them are paid, so i was thinking to save the images in database, is that the good idea or i should move to files only.
First of all, the storage directory should have right permission.
You should create a symbolic link from public/storage to storage/app/public.
Create the symbolic link:
php artisan storage:link
You cannot save images in database, only their names or links etc. I implemented the same thing you did by naming the files to their path and storing that to the database and then using it to fetch the data from folder on sever

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