承接 bst27/laravel-image-proxy 相关项目开发

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

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

bst27/laravel-image-proxy

Composer 安装命令:

composer require bst27/laravel-image-proxy

包简介

A Laravel image proxy to cache, minify and modify images very easily.

README 文档

README

Latest Version on Packagist Tests Total Downloads

A Laravel image proxy to cache, minify and manipulate images very easily.

Features

  • Automatic image compression / minification
  • Automatic caching of images on host and client side
  • Flexible storage options (local, S3, SFTP etc.)
  • Optional: image manipulation (resizing etc.)
  • Optional: custom image filename in URL
  • Easily extendable with custom strategies for image manipulation

Installation

composer require bst27/laravel-image-proxy

Per default spatie/image-optimizer is used to compress images. So make sure you install the required dependencies as described in their docs.

Usage

Use the global helper function proxy_image() to generate a secure image URL:

<img src="{{ proxy_image('images/example.jpg') }}" alt="Example">

This will automatically minify and cache the image and generate something like this:

<img src="http://localhost/img/1AXe...S11lg.jpg" alt="Example">

You can also define a strategy and filename for image manipulation:

<img src="{{ proxy_image('images/example.jpg', 'default', 'cat.jpg') }}" alt="A black cat">

This will use the default strategy for image manipulation, keep the given filename and generate something like this:

<img src="http://localhost/img/1AX5...3c1KAw/cat.jpg" alt="A black cat">

Manipulation Strategies

To manipulate images, you can configure different strategies in config/image-proxy.php. The DefaultManipulator strategy uses spatie/image-optimizer to compress images.

'manipulation_strategy' => [
    'default' => [
        'class'  => \Bst27\ImageProxy\Services\ImageManipulator\DefaultManipulator::class,
        'params' => [],
    ],
],

Each strategy class must implement the ImageManipulator contract. You can add your own image manipulation strategy easily:

  1. Implement the contract interface
  2. Add your manipulator to the manipulation_strategy array of the image-proxy.php with a unique strategy key.
  3. Start using it by calling proxy_image() with your strategy key.

Endpoints

Two routes are registered automatically:

  • Short URL:
    /img/{token}.{ext}

  • Named URL:
    /img/{token}/{filename}

URLs to these routes are generated via proxy_image() and require a valid encrypted payload token. You can customize them via the config.

Storage

Flysystem is used to offer flexible storage options. Per default the original images are read from the local storage disk. The cached images are stored on the local storage disk, too. You can customize the used storage disks using the plugin config or environment settings.

Configuration

Check image-proxy.php for default config. You can customize config via environment variables or publish the config file:

php artisan vendor:publish --provider="Bst27\ImageProxy\ImageProxyServiceProvider"

This will create config/image-proxy.php.

Tests

To run tests, you can execute the following command:

docker run --rm -it \
  -u "$(id -u):$(id -g)" \
  -v "$PWD":/var/www/html \
  -w /var/www/html \
  laravelsail/php84-composer:latest \
  php vendor/bin/phpunit

bst27/laravel-image-proxy 适用场景与选型建议

bst27/laravel-image-proxy 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 621 次下载、GitHub Stars 达 2, 最近一次更新时间为 2025 年 06 月 15 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 bst27/laravel-image-proxy 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 bst27/laravel-image-proxy 我们能提供哪些服务?
定制开发 / 二次开发

基于 bst27/laravel-image-proxy 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-06-15