apanaj /client-optimager
关于此包的最新版本(dev-devel)没有提供许可信息。
图像优化服务客户端。
dev-devel
2018-01-23 11:03 UTC
Requires
- poirot/api-client: dev-devel
- poirot/http: dev-devel
This package is not auto-updated.
Last update: 2024-09-15 04:20:57 UTC
README
图像优化服务的PHP客户端。
// Resize Image: // from url $c = new \Apanaj\Optimager\Client('http://apanaj_optimizer-image'); $img = $c->optimize( (new \Apanaj\Optimager\Client\Command\Optimize()) ->fromUrl('https://helloworld.co.nz/images/helloworld-logo.jpg') ->crop(90, 90) ->quality(100) ); header('Content-Type: image/jpeg'); echo stream_get_contents($img); die; // Resize Image: // from stream or file $c = new \Apanaj\Optimager\Client('http://apanaj_optimizer-image'); $img = $c->optimize( (new \Apanaj\Optimager\Client\Command\Optimize()) ->fromStream(fopen('https://helloworld.co.nz/images/helloworld-logo.jpg', 'rb')) ->resize(90, 90) ->quality(100) );