robotkudos/rkimage 问题修复 & 功能扩展

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

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

robotkudos/rkimage

Composer 安装命令:

composer require robotkudos/rkimage

包简介

Image resizer and watermarker for Laravel.

README 文档

README

Image resizer and watermarker for Laravel.

Install

composer require robotkudos/rkimage

Usage

<?php
use RobotKudos\RKImage\ImageUploader;
use RobotKudos\RKImage\Size;
use RobotKudos\RKImage\Watermark;
use RobotKudos\RKImage\Position;

Route::post('/', function(Request $request) {
    $imageUploader = new ImageUploader();
    // With watermark image, watermark images should be in resources folder (below: resources/img/logo-watermark-light.png)
    $watermark = new Watermark(Position::BottomRight, 'img/logo-watermark-light.png', 'img/logo-watermark-light-x2.png');
    // save returns array of two files saved, if no retina requested, it'll be null
    return var_dump($imageUploader->save($request->myimage->path(), new Size(1500), $watermark));
    // ["image_url"] => "img/image_5f2aeaccc5a110.52811690.jpg" 
    // ["image_url_retina"]=> string(37) "img/image_5f2aeacd2086e3.79326949.jpg"
})

Docs

ImageUploader Class

new ImageUploader($saveRetina = true, $pathToSave = 'img/')

Create a new ImageUploader class.

bool $saveRetina Another version of the image will be saved with twice as big for higher resolution screens.

string $pathToSave The path for the image to be saved in. Must end with /

save()

save($path, Size $size, Watermark $watermark = null, Size $thumb = null, $quality = 80)

Save the image on the public folder, returns the full path of the files saved in an array.

string $path Path to the image to be saved. Most of the times, it should be $request->yourInputName->path()

Size $size Size of image to be saved. This is for normal pixel size, for retina it will be doubled automatically. new Size($width, $height)

Watermark $watermark If you need to add watermark, send null if no watermark is required. new Watermark($pos, $watermarkImagePath = null, $retinaWatermarkImagePath = null, $text = null, Font $font = null)

Size $thumb Size for thumb, null if no thumb is required, will created retina version of thumb is specified on Class creation.

$quality Quality of the image.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-08-05

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固