jreco's avatar
Level 1

how and where can store images with laravel?

how and where I can store images using laravel?

context: I want you in my main view some images are displayed. (These are predefined by me). I also want to store imaganes uploaded by users, however, do not know which side to store these images.

like I can call from the view?

Thank you very much for the help. :)

0 likes
4 replies
usama.ashraf's avatar

You have to distinguish between publicly available images like a banner, background etc and restricted ones. The former can and should go in public/images.

But for user profile photos, I'd suggest keeping them somewhere safe and not public. E.g. if you put them in storage/images/profiles/, access them like this:

    use Intervention\Image\Facades\Image;

    public function getImage($image_path)
    {
        // Check if the visitor/user is allowed to view the image.
        return Image::make(storage_path('/images/profiles/') . $image_path)->response('jpg');
    }

I'm using this package: http://image.intervention.io/getting_started/installation#laravel

christiangerdes's avatar

I use Cloudinary to store and manipulate images uploaded by users. They have a very nice and easy api!

1 like
jekinney's avatar

I also suggest some sort of hosting or cdn for images. Google has a very inexpensive cdn hosting option that should only be a couple $$ a month. As mention though a lot of image hosting services are poping up with amazing features and APIs.

If not the storage/public (I think) if you use envoyer. This keeps your images separate from releases.

1 like

Please or to participate in this conversation.