@SuppressWarnings(PHPMD.CouplingBetweenObjects)
Definition at line 29 of file ImageResize.php.
◆ __construct()
__construct |
( |
State |
$appState, |
|
|
MediaConfig |
$imageConfig, |
|
|
ProductImage |
$productImage, |
|
|
ImageFactory |
$imageFactory, |
|
|
ParamsBuilder |
$paramsBuilder, |
|
|
ViewConfig |
$viewConfig, |
|
|
AssertImageFactory |
$assertImageFactory, |
|
|
ThemeCustomizationConfig |
$themeCustomizationConfig, |
|
|
Collection |
$themeCollection, |
|
|
Filesystem |
$filesystem |
|
) |
| |
- Parameters
-
State | $appState | |
MediaConfig | $imageConfig | |
ProductImage | $productImage | |
ImageFactory | $imageFactory | |
ParamsBuilder | $paramsBuilder | |
ViewConfig | $viewConfig | |
AssertImageFactory | $assertImageFactory | |
ThemeCustomizationConfig | $themeCustomizationConfig | |
Collection | $themeCollection | |
Filesystem | $filesystem | |
Definition at line 100 of file ImageResize.php.
112 $this->appState = $appState;
113 $this->imageConfig = $imageConfig;
114 $this->productImage = $productImage;
115 $this->imageFactory = $imageFactory;
116 $this->paramsBuilder = $paramsBuilder;
117 $this->viewConfig = $viewConfig;
118 $this->assertImageFactory = $assertImageFactory;
119 $this->themeCustomizationConfig = $themeCustomizationConfig;
120 $this->themeCollection = $themeCollection;
◆ resizeFromImageName()
resizeFromImageName |
( |
string |
$originalImageName | ) |
|
Create resized images of different sizes from an original image
- Parameters
-
- Exceptions
-
Definition at line 130 of file ImageResize.php.
132 $originalImagePath = $this->mediaDirectory->getAbsolutePath(
133 $this->imageConfig->getMediaPath($originalImageName)
135 if (!$this->mediaDirectory->isFile($originalImagePath)) {
136 throw new NotFoundException(
__(
'Cannot resize image "%1" - original image not found', $originalImagePath));
138 foreach ($this->getViewImages($this->getThemesInUse()) as $viewImage) {
139 $this->resize($viewImage, $originalImagePath, $originalImageName);
◆ resizeFromThemes()
resizeFromThemes |
( |
array |
$themes = null | ) |
|
Create resized images of different sizes from themes
- Parameters
-
- Returns
- \Generator
- Exceptions
-
Definition at line 149 of file ImageResize.php.
151 $count = $this->productImage->getCountAllProductImages();
153 throw new NotFoundException(
__(
'Cannot resize images - product images not found'));
156 $productImages = $this->productImage->getAllProductImages();
157 $viewImages = $this->getViewImages($themes ?? $this->getThemesInUse());
159 foreach ($productImages as
$image) {
160 $originalImageName =
$image[
'filepath'];
161 $originalImagePath = $this->mediaDirectory->getAbsolutePath(
162 $this->imageConfig->getMediaPath($originalImageName)
164 foreach ($viewImages as $viewImage) {
165 $this->resize($viewImage, $originalImagePath, $originalImageName);
167 yield $originalImageName =>
$count;
The documentation for this class was generated from the following file: