Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/izica/php-progressive-images-webp-jp2-jxr
- Owner: izica
- Created: 2020-03-08T11:18:18.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-04-09T01:06:09.000Z (over 1 year ago)
- Last Synced: 2024-10-10T22:43:06.639Z (about 1 month ago)
- Topics: image-webp, jp2, jpeg2000, jpegxr, jxr, php, progressive-image, progressive-image-loading, webp
- Language: PHP
- Size: 7.81 KB
- Stars: 6
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
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] =>
)
*/
```