-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'b-7.1.x-allow-svg-upload-OEVE-211' into b-7.1.x
- Loading branch information
Showing
30 changed files
with
879 additions
and
327 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © OXID eSales AG. All rights reserved. | ||
* See LICENSE file for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OxidEsales\MediaLibrary\Image\Exception; | ||
|
||
class AggregatorInputType extends \Exception | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © OXID eSales AG. All rights reserved. | ||
* See LICENSE file for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OxidEsales\MediaLibrary\Image\Exception; | ||
|
||
class NoSupportedDriversForSource extends \Exception | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © OXID eSales AG. All rights reserved. | ||
* See LICENSE file for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OxidEsales\MediaLibrary\Image\Service; | ||
|
||
use OxidEsales\MediaLibrary\Image\DataTransfer\ImageSizeInterface; | ||
use OxidEsales\MediaLibrary\Image\Exception\AggregatorInputType; | ||
use OxidEsales\MediaLibrary\Image\Exception\NoSupportedDriversForSource; | ||
use OxidEsales\MediaLibrary\Image\ThumbnailGenerator\ThumbnailGeneratorInterface; | ||
|
||
class ThumbnailGeneratorAggregate implements ThumbnailGeneratorAggregateInterface | ||
{ | ||
/** | ||
* @param iterable<ThumbnailGeneratorInterface> $thumbnailGenerators | ||
* @throws AggregatorInputType | ||
*/ | ||
public function __construct( | ||
protected iterable $thumbnailGenerators | ||
) { | ||
foreach ($this->thumbnailGenerators as $oneGenerator) { | ||
if (!$oneGenerator instanceof ThumbnailGeneratorInterface) { | ||
throw new AggregatorInputType(); | ||
} | ||
} | ||
} | ||
|
||
public function getSupportedGenerator(string $sourcePath): ThumbnailGeneratorInterface | ||
{ | ||
foreach ($this->thumbnailGenerators as $oneDriver) { | ||
if ($oneDriver->isOriginSupported($sourcePath)) { | ||
return $oneDriver; | ||
} | ||
} | ||
|
||
throw new NoSupportedDriversForSource(); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/Image/Service/ThumbnailGeneratorAggregateInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © OXID eSales AG. All rights reserved. | ||
* See LICENSE file for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OxidEsales\MediaLibrary\Image\Service; | ||
|
||
use OxidEsales\MediaLibrary\Image\ThumbnailGenerator\ThumbnailGeneratorInterface; | ||
|
||
interface ThumbnailGeneratorAggregateInterface | ||
{ | ||
public function getSupportedGenerator(string $sourcePath): ThumbnailGeneratorInterface; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © OXID eSales AG. All rights reserved. | ||
* See LICENSE file for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OxidEsales\MediaLibrary\Image\ThumbnailGenerator; | ||
|
||
use OxidEsales\MediaLibrary\Image\DataTransfer\ImageSizeInterface; | ||
|
||
class DefaultDriver implements ThumbnailGeneratorInterface | ||
{ | ||
public function isOriginSupported(string $sourcePath): bool | ||
{ | ||
return true; | ||
} | ||
|
||
public function generateThumbnail( | ||
string $sourcePath, | ||
string $thumbnailPath, | ||
ImageSizeInterface $thumbnailSize, | ||
bool $isCropRequired, | ||
): void { | ||
copy(__DIR__ . '/../../../assets/out/src/img/default.svg', $thumbnailPath); | ||
} | ||
|
||
public function getThumbnailFileName( | ||
string $originalFileName, | ||
ImageSizeInterface $thumbnailSize, | ||
bool $isCropRequired | ||
): string { | ||
return 'default.svg'; | ||
} | ||
|
||
public function getThumbnailsGlob(string $originalFilename): string | ||
{ | ||
return 'default.svg'; | ||
} | ||
} |
Oops, something went wrong.