Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/izica/php-progressive-images-webp-jp2-jxr

Php library for converting and caching images to Webp .webp, JpegXr .jxr, Jpeg 2000 .jp2
https://github.com/izica/php-progressive-images-webp-jp2-jxr

image-webp jp2 jpeg2000 jpegxr jxr php progressive-image progressive-image-loading webp

Last synced: 8 days ago
JSON representation

Php library for converting and caching images to Webp .webp, JpegXr .jxr, Jpeg 2000 .jp2

Awesome Lists containing this project

README

        

## Description
Library converts your images to progressive images formats

* Webp
* Jpeg 2000
* Jpeg XR

## Warning
Currently works only on Unix systems, you can help me achieve cross-platform waiting for your pull requests.

## Requirements
```shell script
imagemagick
webp
libjxr-tools
```

## Installation
```
sudo apt-get install imagemagick webp libjxr-tools
composer require izica/php-progressive-images-webp-jp2-jxr
```

## Usage(Examples)
```php
setFileName('custom-file-name')
->setDestinationFolder($_SERVER['DOCUMENT_ROOT'] . '/test/cache/')
->convert();
/*

Izica\ProgressiveImagesResponse Object
(
[source] => /upload/iblock/fe7/fe7728c5f2c6763693eb1d9ef105c46c.png
[webp] => /test/cache/custom-file-name.webp
[jpeg2000] => /test/cache/custom-file-name.jp2
[jpegxr] => /test/cache/custom-file-name.jxr
)
*/
?>




```

```php
$arData = \Izica\ProgressiveImages::fromFileSource('/upload/iblock/fe7/fe7728c5f2c6763693eb1d9ef105c46c.png')
->setFileName('custom-file-name')
->setDestinationFolder($_SERVER['DOCUMENT_ROOT'] . '/test/cache/')
->convert()
->toArray();
/*
Array
(
[source] => /upload/iblock/fe7/fe7728c5f2c6763693eb1d9ef105c46c.png
[webp] => /test/cache/custom-file-name.webp
[jpeg2000] => /test/cache/custom-file-name.jp2
[jpegxr] => /test/cache/custom-file-name.jxr
)
*/
```

```php
$arData = \Izica\ProgressiveImages::fromFileSource('/upload/iblock/fe7/fe7728c5f2c6763693eb1d9ef105c46c.png')
->setFileName('custom-file-name')
->setDestinationFolder($_SERVER['DOCUMENT_ROOT'] . '/test/cache/')
->withoutJpegXr()
->withoutJpeg2000()
->convert();
/*
Izica\ProgressiveImagesResponse Object
(
[source] => /upload/iblock/fe7/fe7728c5f2c6763693eb1d9ef105c46c.png
[webp] => /test/cache/custom-file-name.webp
[jpeg2000] =>
[jpegxr] =>
)
*/
```