PHPackages                             widgets-nl/image-processor - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. widgets-nl/image-processor

ActiveLibrary[Image &amp; Media](/categories/media)

widgets-nl/image-processor
==========================

A PHP library to resize / convert images

1.0(7y ago)1308proprietaryPHPPHP &gt;=7.0

Since Aug 24Pushed 7y ago3 watchersCompare

[ Source](https://github.com/WidgetsNL/image-processor)[ Packagist](https://packagist.org/packages/widgets-nl/image-processor)[ RSS](/packages/widgets-nl-image-processor/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (2)DependenciesVersions (4)Used By (0)

ImageProcessor
==============

[](#imageprocessor)

A PHP library to resize / convert images

Table of contents
-----------------

[](#table-of-contents)

- [Requirements](#requirements)
- [Installation](#installation)
    - [Composer](#installation-composer)
    - [Manual installation](#installation-manual)
- [Usage](#usage)
    - [Basic usage](#usage-basic)
    - [Specify image type](#usage-type)
    - [Output to string](#usage-output-raw)
    - [Output to base64 encoded string / base64 data URI](#usage-output-base64)
- [Reference](#reference)
    - [ImageProcessor](#reference-image-processor)
        - [\_\_construct()](#reference-image-processor-constructor)
        - [setResourceFromPath()](#reference-image-processor-set-resource-from-path)
        - [setResourceFromFileData()](#reference-image-processor-set-resource-from-file-data)
        - [getWidth()](#reference-image-processor-get-width)
        - [setWidth()](#reference-image-processor-set-width)
        - [getHeight()](#reference-image-processor-get-height)
        - [setHeight()](#reference-image-processor-set-height)
        - [Object fit](#reference-image-processor-object-fit)
            - [getObjectFit()](#reference-image-processor-get-object-fit)
            - [setObjectFit()](#reference-image-processor-set-object-fit)
        - [Canvas fit](#reference-image-processor-canvas-fit)
            - [getCanvasFit()](#reference-image-processor-get-canvas-fit)
            - [setCanvasFit()](#reference-image-processor-set-canvas-fit)
        - [Type](#reference-image-processor-type)
            - [getType()](#reference-image-processor-get-type)
            - [setType()](#reference-image-processor-set-type)
        - [Quality](#reference-image-processor-quality)
            - [getQuality()](#reference-image-processor-get-quality)
            - [setQuality()](#reference-image-processor-set-quality)
        - [Background](#reference-image-processor-background)
            - [getBackground()](#reference-image-processor-get-background)
            - [setBackground()](#reference-image-processor-set-background)
        - [getFileData()](#reference-image-processor-get-file-data)
        - [save()](#reference-image-processor-save)
    - [ImageResource](#reference-image-resource)

Requirements
------------

[](#requirements)

- PHP 7+
- [GD library](http://php.net/manual/en/book.image.php)

Installation
------------

[](#installation)

#### Using Composer

[](#using-composer)

Run the following command:

```
composer require widgets-nl/image-processor

```

### Manual installation

[](#manual-installation)

- Clone or download the project
- Copy `ImageProcessor.php` and `ImageResource.php` to your directory of choice.
- Make sure the two files are autoloaded / included e.g.:

```
require_once 'ImageProcessor.php';
require_once 'ImageResource.php';
```

Usage
-----

[](#usage)

#### Basic usage

[](#basic-usage)

```
