PHP code example of svycka / sv-images

1. Go to this page and download the library: Download svycka/sv-images library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

svycka / sv-images example snippets


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);
    }
}

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);
    }
}