0
votes

It's been a while since I open my Laravel directory and I found there are many images in storage/app folder (probably copied from the public directory) but I don't remember ever putting uploaded images there. did Laravel put them there automatically? How do I turn it off? It causes my disk to be full.

Here's my upload script...

<?php

protected function uploadPhoto($photo, $photoName)
{
    $attachment = $photo;
    $photoName =  $photoName.'.jpg';
    $storePhoto = ($attachment) ? $attachment->storeAs('gallery', $photoName) : null;

    if ($storePhoto) {
        $path = public_path('images/' . $storePhoto);
        $path_thumb = public_path('images/' . str_replace('gallery', 'gallery/thumbnails/', $storePhoto));

        $img = Image::make($attachment->getRealPath());
        $img->resize(1024, null, function ($constraint) {
            $constraint->aspectRatio();
        });

        if ($img->save($path, 85)) {
            Image::make($path)->resize(300, null, function ($constraint) {
                $constraint->aspectRatio();
            })->Save($path_thumb, 60);
        }
    }
}
1

1 Answers

0
votes

Laravel does not automatically generate images in your directory. I would advise you to put a captcha on downloading images, as well as set permissions on the directory 755