All Projects → webino → WebinoImageThumb

webino / WebinoImageThumb

Licence: BSD-3-Clause license
✂️ Webino™ Image thumbnailer for Zend Framework [LTS] http://webino.github.io/WebinoImageThumb

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to WebinoImageThumb

video thumbnail
This plugin generates thumbnail from video file or URL. It returns image in memory or writes into a file. It offers rich options to control the image format, resolution and quality. Supports iOS and Android.
Stars: ✭ 159 (+297.5%)
Mutual labels:  thumbnail
create-require
Polyfill for Node.js module.createRequire (<= v12.2.0)
Stars: ✭ 24 (-40%)
Mutual labels:  module
react-watermark-module
React水印组件,支持图片水印,文字水印。
Stars: ✭ 31 (-22.5%)
Mutual labels:  module
OregonCore-Modules
Modules made for Oregoncore
Stars: ✭ 18 (-55%)
Mutual labels:  module
Stripe-Payment-For-Opencart-3.x
Stripe payment module for opencart 3.x
Stars: ✭ 29 (-27.5%)
Mutual labels:  module
ReDe
A Redis dehydrator module
Stars: ✭ 63 (+57.5%)
Mutual labels:  module
modjpeg-nginx
NGINX filter module for adding overlays and logos to JPEGs on-the-fly without degrading the quality of the image.
Stars: ✭ 18 (-55%)
Mutual labels:  module
ark.db
Small and fast JSON database for Node and browser. 😋
Stars: ✭ 65 (+62.5%)
Mutual labels:  module
heroku-lavalink
Deploy lavalink on heroku.
Stars: ✭ 46 (+15%)
Mutual labels:  lts
hal stm32
No description or website provided.
Stars: ✭ 56 (+40%)
Mutual labels:  module
KanColle-English-Patch-KCCP
English Patch for the original KanColle browser game, to be used with KCCacheProxy. Translates most of the game into english.
Stars: ✭ 28 (-30%)
Mutual labels:  wip
zray-installer
Zend Z-Ray Easy Installer for Laravel Homestead
Stars: ✭ 22 (-45%)
Mutual labels:  zend
pepatch
A hacky tool to patch PE binaries.
Stars: ✭ 21 (-47.5%)
Mutual labels:  wip
yii2-queue-monitor
Yii2 Queue Analytics Module
Stars: ✭ 99 (+147.5%)
Mutual labels:  module
go-external-ip
a Golang library to get your external ip from multiple services
Stars: ✭ 55 (+37.5%)
Mutual labels:  wip
ScsmPx
System Center Service Manager PowerShell Extensions
Stars: ✭ 30 (-25%)
Mutual labels:  module
ProtocolServiceKit
iOS组件通信中间件(Protocol Service),Adapter Swift/Objective-C
Stars: ✭ 139 (+247.5%)
Mutual labels:  module
visual-graph-explorer
A simple graph explorer leveraging yFiles for HTML, neo4j bolt, implemented using VueJS and Vuetify
Stars: ✭ 13 (-67.5%)
Mutual labels:  wip
ui5-cap-event-app
Showcase of SAP Cloud Application Programming Model and OData V4 with draft mode in a freestyle SAPUI5 app and an SAP Fiori elements app.
Stars: ✭ 70 (+75%)
Mutual labels:  wip
Thread
type safe multi-threading made easier
Stars: ✭ 34 (-15%)
Mutual labels:  module

Image Thumbnailer
for Zend Framework 2

Build Status Coverage Status Scrutinizer Quality Score Dependency Status
Latest Stable Version Total Downloads Latest Unstable Version License

Service that provides API to manipulate images.

Features

  • Resize, crop, pad, rotate, show and save images
  • Create image reflection
  • Crop whitespace
  • Sharpen images
  • Watermark

Setup

Following steps are necessary to get this module working, considering a zf2-skeleton or very similar application:

  1. Run: php composer.phar require webino/webino-image-thumb:dev-develop
  2. Add WebinoImageThumb to the enabled modules list

Requirements

  • PHP >= 5.6
  • GD 2.0+

QuickStart

  • For example add following code into the controller action, assume example image:

    // We encourage to use Dependency Injection instead of Service Locator
    $thumbnailer = $this->getServiceLocator()->get('WebinoImageThumb');
    $imagePath   = 'public/images/example.jpg';
    $thumb       = $thumbnailer->create($imagePath, $options = [], $plugins = []);
    
    $thumb->resize(100, 100);
    
    $thumb->show();
    // or/and
    $thumb->save('public/images/resized.jpg');
    

    NOTE: If you don't know how to inject the WebinoImageThumb into action controller, check out test/resources

  • Use reflection plugin:

    $reflection = $thumbnailer->createReflection(40, 40, 80, true, '#a4a4a4');
    $thumb      = $thumbnailer->create($imagePath, [], [$reflection]);
    
  • Use whitespace cropper plugin:

    $cropper = $thumbnailer->createWhitespaceCropper();
    $thumb   = $thumbnailer->create($imagePath, [], [$cropper]);
    
  • Use sharpen plugin:

    $sharpen = $thumbnailer->createSharpen();
    $thumb   = $thumbnailer->create($imagePath, [], [$sharpen]);
    
  • Use watermark plugin:

    $watermarkPath  = 'public/images/my_watermark.png';
    $watermarkThumb = $thumbnailer->create($watermarkPath);
    $watermark      = $thumbnailer->createWatermark($watermarkThumb);
    $thumb          = $thumbnailer->create($imagePath, [], [$watermark]);
    

Options

The options array allows you to customize the behavior of the library a bit. Some of these options are implementation-specific, and are noted as such. So, let's first go over what options are available to us:

Option Name Description Default Value Valid Values
resizeUp Whether or not to scale an image up to the desired dimensions false true / false
jpegQuality What quality to save jpeg files with (how much compression to use, 100 being none) 100 1-100
correctPermissions Whether or not the library should attempt to correct file permissions. This will only work if you set up your PHP to allow chmod operations false true / false
preserveAlpha Whether or not to preserve alpha transparency in PNG files true true / false
alphaMaskColor What rgb color should be used for the alpha mask [255, 255, 255] [0-255, 0-255, 0-255]
preserveTransparency Whether or not to preserve transparency in GIF files true true / false
transparencyMaskColor What rgb color should be used for the transparency mask [255, 255, 255] [0-255, 0-255, 0-255]
interlace When the interlace option equals true or false call imageinterlace null true / false

Functions

  • adaptiveResize($width, $height)
  • adaptiveResizePercent($width, $height, $percent = 50)
  • adaptiveResizeQuadrant($width, $height, $quadrant = 'T|B|C|L|R')
  • crop($startX, $startY, $cropWidth, $cropHeight)
  • cropFromCenter($cropWidth, $cropHeight = null)
  • pad($width, $height, $color = [255, 255, 255])
  • resize($maxWidth, $maxHeight)
  • resizePercent($percent)
  • rotateImage($direction = 'CW|CCW')
  • rotateImageNDegrees($degrees)
  • save($fileName, $format = 'GIF|JPG|PNG')
  • show($rawData = false)

Getters / Setters

  • getCurrentDimensions()
  • getFileName()
  • getFormat()
  • getIsRemoteImage()
  • getMaxHeight()
  • getMaxWidth()
  • getNewDimensions()
  • getOldImage()
  • getOptions()
  • getPercent()
  • getWorkingImage()
  • setCurrentDimensions($currentDimensions)
  • setFileName($fileName)
  • setFormat($format)
  • setMaxHeight($maxHeight)
  • setMaxWidth($maxWidth)
  • setNewDimensions($newDimensions)
  • setOldImage($oldImage)
  • setOptions($options)
  • setPercent($percent)
  • setWorkingImage($workingImage)

Reflection plugin

  • createReflection($percent, $reflection, $white, $border, $borderColor)

    • $percent - What percentage of the image to create the reflection from.
    • $reflection - What percentage of the image height should the reflection height be.
    • $white - How transparent (using white as the background) the reflection should be, as a percent.
    • $border - Whether a border should be drawn around the original image.
    • $borderColor - The hex value of the color you would like your border to be.

Whitespace Cropper plugin

  • createWhitespaceCropper($border, $color)

    • $margin - What pixels of a margin should be around the original image.
    • $color - The hex value of the color you would like to crop.

Watermark plugin

  • createWatermark(PHPThumb $watermarkThumb, $position = [0, 0], $scale = .5)

    • $watermarkThumb - Watermark image from watermark file.
    • $position - Position of watermark, center by default:
      • [0, 0] - center
      • [-1, -1] - left bottom
      • [-1, 1] - left top
      • [1, 1] - right top
      • [1, -1] - right bottom
    • $scale - Scale of the watermark relative to the image.

Changelog

3.0.0 [UNRELEASED]

  • Removed deprecated plugin classes

2.1.0

  • Requires webino/thumbnailer replacing masterexploder/PHPThumb
  • Deprecated plugin classes, moved to webino/thumbnailer package

2.0.0

  • PHP >= 5.6
  • Requires PHPThumb 2.0 via composer
  • Added Whitespace Cropper plugin
  • Added Sharpen plugin
  • Removed ZF autoloader support
  • Added Watermark plugin
  • Added ImageThumbAwareInterface & Trait

1.0.0

  • Initial release

Development

Dependency Status

We will appreciate any contributions on development of this module.

Learn How to develop Webino modules

Addendum

Most of the documentation is taken from the PHPThumb wiki.

Please, if you are interested in this Zend Framework module report any issues and don't hesitate to contribute.

Report a bug | Fork me

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].