shawnsandy/img-fly 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

shawnsandy/img-fly

Composer 安装命令:

composer require shawnsandy/img-fly

包简介

Dynamically resize images on the Fly

README 文档

README

Screenshot

Laravel ImgFly

Dynamically resize images on the Fly in your Laravel App using the Glide library from thephpleague.

Glide is a wonderfully easy on-demand image manipulation library written in PHP. Its straightforward API is exposed via HTTP, similar to cloud image processing services like Imgix and Cloudinary. Glide leverages powerful libraries like Intervention Image (for image handling and manipulation) and Flysystem (for file system abstraction).

  • Adjust, resize and add effects to images using a simple HTTP based API.
  • Manipulated images are automatically cached and served with far-future expires headers.
  • Create your own image processing server or integrate Glide directly into your app.
  • Supports both the GD library and the Imagick PHP extension.
  • Supports many response methods, including PSR-7, HttpFoundation and more.
  • Ability to secure image URLs using HTTP signatures.
  • Works with many different file systems, thanks to the Flysystem library.
  • Powered by the battle tested Intervention Image image handling and manipulation library.
  • Framework-agnostic, will work with any project.
  • Composer ready and PSR-2 compliant.
  • Get more info - glide.thephpleague.com

Install Glide Laravel

Via composer repository

  • Installs using composer repositories add the following to your composer.json file
"repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/shawnsandy/img-fly"
        }
    ],
  • Run the composer require to install the package
composer require shawnsandy/img-fly

In Laravel 5.5 and higher the package automatically installs itself. If you are running Laravel 5.4 or earlier please follow the instructions below.

  • Add the provider to your config\app.php providers.
ShawnSandy\ImgFly\ImgflyServiceProvider::class,
  • Add the facade to your config\app.php alias.
"Imgfly" => ShawnSandy\ImgFly\Classes\ImgflyFacade::class,

Routes

  • Add the route to your routes\web.php
Imgfly::routes();

Dependencies (required)

composer require league/glide-laravel

Usage

  • Display and resize an image from your Storage folder storage/app/images directory w=500 sets the image width to 500.
<img src="{{ Imgfly::imgFly('apple-mouse.jpeg?w=500') }}" alt="">
  • Display and resize an image from your public/img directory w=500 sets the image width parameter to 500. Read more on setting additional parameters (height, crop, orientation) Glide quick reference.
<img src="{{ Imgfly::imgPublic('hands.jpeg?w=500', 'img') }}" alt="">

Presets

You can also use preset to dynamically resize image on the fly. Parameters are set in the config app/imgfly.php

  • Publish the config file
php artisan vendor:publish --tag=imgfly_config
  • Open and modify the presets
[

    "icon" => "?w=60&h=60&fit=crop-center",

    "small" => "?w=100&h=100&fit=crop-center",

    "thumbnail" => "?w=200&h=200&fit=crop-center",

    "medium" => "?w=600&h=400&fit=crop-center",

    "large" => "?w=1200&h=600&fit=crop-center",

];
  • Call the facade Imgfly::imgPreset(image, preset_key = small, callBackMethod = 'img/imgPublic')
<img src="{{ Imgfly::imgPreset('hands.jpg', 'icon') }}" alt="">
<img src="{{ Imgfly::imgPreset('hands.jpg', 'small') }}" alt="">
<img src="{{ Imgfly::imgPreset('hands.jpg', 'thumbnail') }}" alt="">

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email shawnsandy04@gmail.com instead of using the issue tracker.

Credits

  • [Shawn Sandy][link-author]

TODO

  • Add image upload ui
  • Add unit test

License

shawnsandy/img-fly 适用场景与选型建议

shawnsandy/img-fly 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.06k 次下载、GitHub Stars 达 28, 最近一次更新时间为 2018 年 01 月 24 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 shawnsandy/img-fly 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 5.06k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 28
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 28
  • Watchers: 3
  • Forks: 20
  • 开发语言: PHP

其他信息

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