svycka/sv-images

使用PHP编写的图像处理库,类似于Imgix和Cloudinary等云图像处理服务。此模块简化了Zend Framework 2中的图像处理

0.1.0 2016-04-07 06:50 UTC

This package is auto-updated.

Last update: 2024-09-10 19:42:14 UTC


README

Build Status Coverage Status Quality Score Latest Version on Packagist Software License Total Downloads

使用PHP编写的图像处理库,类似于ImgixCloudinary等云图像处理服务。此模块简化了Zend Framework 2中的图像处理

安装

通过Composer

$ composer require svycka/sv-images

基本用法

  • 在config/application.config.php中注册SvImages模块
  • 创建文件系统工厂,例如
class ImageFilesystemFactory implements FactoryInterface
{
    public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $flysystem = new \League\Flysystem\Filesystem(new Local(__DIR__.'/path/to/files'));
        $adapter = new \SvImages\Filesystem\Adapter\FlySystemAdapter($flysystem);
        return new \SvImages\Filesystem\Filesystem($adapter);
    }
}
  • 创建缓存存储,为了最佳性能,应指向公共目录,这样一旦生成缓存,PHP就不会被再次调用,例如
class ImageCacheStorageFactory implements FactoryInterface
{
    public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $flysystem = new \League\Flysystem\Filesystem(new Local(__DIR__.'/path/to/public'));
        return new \SvImages\Cache\FlySystemStorage($flysystem);
    }
}

变更日志

有关最近更改的更多信息,请参阅CHANGELOG

鸣谢

许可证

MIT许可证(MIT)。有关更多信息,请参阅许可证文件