繁体   English   中英

存储目录中充满了来自公共的复制映像-Laravel

[英]Storage Directory full of copy image from public - Laravel

自从我打开Laravel目录以来,已经有一段时间了,我发现storage / app文件夹中有很多图像(可能是从公共目录复制的),但是我不记得曾经将上传的图像放在那里。 Laravel会自动将它们放在那里吗? 如何关闭它? 它导致我的磁盘已满。

这是我的上传脚本...

<?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);
        }
    }
}

Laravel不会在您的目录中自动生成图像。 我建议您在下载图像时输入验证码,并在目录755上设置权限

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM