Skip to content

Instantly share code, notes, and snippets.

@gggeek
Last active December 7, 2022 10:41
Show Gist options
  • Select an option

  • Save gggeek/d43fe620d32dc7bcc07a to your computer and use it in GitHub Desktop.

Select an option

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

Copy link
Copy Markdown

What does $filter values refer to? Is '180x146' the key for a configuration somewhere or is it an instruction on its own?

@gggeek

gggeek commented Oct 14, 2015

Copy link
Copy Markdown
Author

a key

@gggeek

gggeek commented Oct 14, 2015

Copy link
Copy Markdown
Author

updating the gist

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