stormwild/image-resizer 问题修复 & 功能扩展

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

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

stormwild/image-resizer

最新稳定版本:1.0.0

Composer 安装命令:

composer require stormwild/image-resizer

包简介

PHP class to resize images using GD

README 文档

README

PHP class to resize images using GD

History

Although, I used a version of this class in a recent project, this is really just an exercise for me to create a simple PHP class library shared through Composer and Packagist.

Setup

This package is available through Packagist with the vendor and package identifier the same as this repo.

If using Composer, in your composer.json file add:

{
    "require": {
        "stormwild/image-resizer": "1.0.0"
    }
}

Otherwise:

include '/path/to/ImageResizer.php';

Because this class uses namespacing, when instantiating the object, you need to either use the fully qualified namespace:

$resized = \Stormwild\ImageResizer::resizer($path, $width, $height);

Or alias it:

use \Stormwild\ImageResizer;

$resized = ImageResizer::resizer($path, $width, $height);

Usage

    // possibly in controller action
    // check if image uploaded successfully
    // get path to uploaded image
    
    $path = "path/to/uploaded/file.ext"; // real path to file on server
    $width = 1050;
    $height = 700;    
    
    $resized = ImageResizer::resize($path, $width, $height);
    
    if($resized) {
        // upload to cloud storage
        // get url from cloud
        // save model with reference to image url
    }

The function resizes and replaces(updates) the uploaded file to the specified dimensions.

References

Credits to the many code samples on image resizing using GD on the web. In particular, I referenced the following:

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-01-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固