1. Go to this page and download the library: Download ashleydawson/glide-bundle 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/ */
ashleydawson / glide-bundle example snippets
$bundles = array(
// ...
new AshleyDawson\GlideBundle\AshleyDawsonGlideBundle(),
);
namespace Acme\AcmeBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use League\Flysystem\Adapter\Local;
use League\Flysystem\Filesystem;
class MyController extends Controller
{
/**
* @Route("/images/{image_name}.jpg")
*/
public function showImageAction(Request $request)
{
// Filesystems for source and cache
$sourceFilesystem = new Filesystem(new Local('/path/to/source/dir'));
$cacheFilesystem = new Filesystem(new Local('/path/to/cache/dir'));
// Create a Glide server
$glideServer = $this
->get('ashleydawson.glide.server_factory')
->create($sourceFilesystem, $cacheFilesystem)
;
// Return the processed image response
return $glideServer->getImageResponse($request->get('image_name'), $request->query->all());
}
}
namespace Acme\AcmeBundle\Glide\Manipulator;
use League\Glide\Api\Manipulator\ManipulatorInterface;
use Intervention\Image\Image;
use Symfony\Component\HttpFoundation\Request;
class MyAwesomeManipulator implements ManipulatorInterface
{
/**
* {@inheritdoc}
*/
public function run(Request $request, Image $image)
{
if ($request->has('awesome')) {
// Do something awesome to the image here...
}
return $image;
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.