定制 gevman/azure-thumbnails 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

gevman/azure-thumbnails

Composer 安装命令:

composer require gevman/azure-thumbnails

包简介

Create image thumbnails with help of Microsoft Artificial Intelligence, and show what needed! After uploading an image, a high quality thumbnail gets generated and the Computer Vision API algorithm analyzes the objects within the image, then crops it to fit the requirements of the “region of interes

README 文档

README

Latest Stable Version Latest Unstable Version License

Create image thumbnails with help of Microsoft Artificial Intelligence, and show what needed!

A thumbnail is a small representation of a full-size image. Varied devices such as phones, tablets, and PCs create a need for different user experience (UX) layouts and thumbnail sizes. Using smart cropping, this Computer Vision API feature helps solve the problem.

After uploading an image, a high quality thumbnail gets generated and the Computer Vision API algorithm analyzes the objects within the image, then crops it to fit the requirements of the “region of interest” (ROI). The output gets displayed within a special framework as seen in below illustration. The generated thumbnail can be presented in a different aspect ratio than that of the original image to accommodate a user’s needs.

The thumbnail algorithm works as follows:

  • Removes distracting elements from the image and recognizes the main object, the “region of interest” (ROI).
  • Crops the image based on identified “region of interest”.
  • Changes the aspect ratio to fit the target thumbnail dimensions.

gevman/azure-thumbnails

Installation (using composer)

composer require gevman/azure-thumbnails

Methods

thumbnail(string $image, int $width, int $height)
Create thumbnail
  • $image - full path of image
  • $width - thumbnail width
  • $height - thumbnail height
saveAs(string $file [, int $quality = 99])
Save thumbnail to specified path
  • $file - full path of thumbnail
  • $quality - thumbnail quality
show([int $quality = 99][, string $contentType = 'image/jpeg'])
Show thumbnail
  • $quality - thumbnail quality
  • $contentType - Content-Type header

Example of usage

Get your Computer Vision API key from Microsoft Azure
require '../vendor/autoload.php';

$generator = new \Gevman\Thumbnails\Generator('{Computer Vision API key}');

$thumb = $generator->thumbnail('/full/path/to/original.jpg', 1000, 500);

//will save thumbnail to specified path
$thumb->saveAs('/full/path/to/thumbnail.jpg', 100);

//will show thumbnail
$thumb->show();

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-03-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固