承接 fuwasegu/php-base64-image 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

fuwasegu/php-base64-image

最新稳定版本:1.1.0

Composer 安装命令:

composer require fuwasegu/php-base64-image

包简介

Library for easy handling of base64-encoded images in PHP

README 文档

README

Coverage Status example workflow MIT License

Library for easy handling of base64-encoded images in PHP

📦 Installation

composer require fuwasegu/php-base64-image

✅ Usage

Assuming you are using this package in a Laravel project, you can use it as follows:

💡Tips

Of course, this library does not depend on Laravel, so it can be used for pure PHP projects as well.

<?php

declare(strict_types=1);

namespace App\Http\Controllers;

use Fuwasegu\PhpBase64Image\Image;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
use Str;

class ImageSaveController
{
    public function __invoke(Request $request): JsonResponse
    {
        // Base64 encoded image data uri
        $dataUri = $request->input('image');
        
        // Create Image object from base64 image data uri
        $image = Image::fromBase64($dataUri);
        
        // Random string for image name based on uuid
        $uuid = Str::uuid();
        
        // Upload to S3 using Storage facade
        Storage::put(
            path: "images/{$uuid}.{$image->extension()->value}",
            contents: $image->data(),
            options: 'private',
        );
        
        return new JsonResponse(['message' => 'success'], 200);
    }
}

统计信息

  • 总下载量: 184
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-01-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固