将 milon/barcode 生成的条形码图像保存在我的存储文件夹中(在 Laravel 中)

Save barcode Image generated with milon/barcode in my storage folder (in Laravel)

我实现了这个库来在我的 laravel 项目中生成条形码图像 https://github.com/milon/barcode

一切正常,图像生成正确,但现在我想将条形码图像保存在我的存储文件夹中

对于条形码图像,我只是在数据库中添加一个值,然后将该值转换为条形码图像

这是我在数据库中添加值的代码:

<div class="form-group {{ $errors->first('barcode', 'has-error') }}">
    <label for="title" class="col-sm-3 control-label">
        Barcode
    </label>

    <div class="col-sm-6">
        {{ Form::text('barcode', NULL, ['class' => 'form-control required', 'minlength' => 3]) }}
    </div>
</div>

这是我用来生成条形码图像的代码:

{!!  DNS1D::getBarcodeHTML("$employee->barcode", "C39")!!}

试试这个

\Storage::disk('public')->put('test.png',base64_decode(DNS2D::getBarcodePNG("4", "PDF417")));

确保您的存储文件夹具有写入权限。