Skip to content

Instantly share code, notes, and snippets.

@gggeek
Last active December 7, 2022 10:41
Show Gist options
  • Save gggeek/d43fe620d32dc7bcc07a to your computer and use it in GitHub Desktop.
Save gggeek/d43fe620d32dc7bcc07a to your computer and use it in GitHub Desktop.
$dataManager = $this->getContainer()->get('liip_imagine.data.manager');
$filterManager = $this->getContainer()->get('liip_imagine.filter.manager');
$assetManager = $this->getContainer()->get('eris_fo.assets_manager');
$variationManager = $this->getContainer()->get('eris_fo.assets.variation_generator');
// works using the custom data loader as set in imaginebundle config
$fullSizeImagePath = '/images/content/advertising.png';
$filters = $this->getContainer()->getParameter('assets_image_variations');
$targetAssetsBucket = 'images';
foreach ($filters as $filter) {
$targetFileName = $variationManager->getVariationFileName($fullSizeImagePath, $filter);
//var_dump($targetFileName);exit;
$image = $dataManager->find($filter, $fullSizeImagePath);
$response = $filterManager->applyFilter($image, $filter);
$assetManager->uploadFileContentsToBucket($response->getContent(), $targetFileName, $targetAssetsBucket);
}
@gggeek
Copy link
Author

gggeek commented Oct 14, 2015

updating the gist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment