Skip to content

Commit

Permalink
Readies command and composer.json for 1.0.0 release.
Browse files Browse the repository at this point in the history
  • Loading branch information
christophluehr committed Sep 9, 2019
1 parent 30cfb62 commit 24411ae
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 18 deletions.
11 changes: 10 additions & 1 deletion BasilicomThumbnailBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,19 @@

class BasilicomThumbnailBundle extends AbstractPimcoreBundle
{

public function getJsPaths()
{
return [
'/bundles/basilicomthumbnail/js/pimcore/startup.js'
];
}
}

/**
* @return Installer
*/
public function getInstaller()
{
return new Installer();
}
}
20 changes: 11 additions & 9 deletions Command/ThumbnailCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,13 @@ public function __construct(string $name = null, MessageBusInterface $bus)
protected function configure()
{
$this->setName('basilicom:thumbnail')
->setDescription('Generates missing Thumbnails')
->setHelp('this command generates thumbnails');
->setDescription('Generates missing thumbnails by dispatching ThumbnailJob messages')
->setHelp('This command generates thumbnails')
->addArgument(
'assetId',
InputArgument::REQUIRED,
'The asset ID'
);
}

/**
Expand All @@ -34,16 +39,13 @@ protected function configure()
*
* @return int|null|void
*
* @example bin/console basilicom:thumbnail
*
* - is the input file in expected format:
* does it have a column 'key'
* are there any fields that pimcore doesn't know about
* @example bin/console basilicom:thumbnail <assetId>
*
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->bus->dispatch(new ThumbnailJob(1));
$output->writeln('thumbnail creation');
$assetId = $input->getArgument('assetId');
$this->bus->dispatch(new ThumbnailJob((int)$assetId));
$output->writeln('Dispatched ThumbnailJob for assetId='.$assetId);
}
}
File renamed without changes.
8 changes: 4 additions & 4 deletions MessageHandler/ThumbnailHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ class ThumbnailHandler implements MessageHandlerInterface
{
public function __invoke(ThumbnailJob $message)
{
Logger::debug('BTB Reveived ThumbnailJob with asset ID'.$message->getAssetId());
Logger::debug('BTB Received ThumbnailJob with assetId '.$message->getAssetId());

$asset = Asset::getById($message->getAssetId());

if (!is_object($asset)) {
if (! $asset instanceof Asset\Image) {
return;
}

// clear placeholders
// clear placeholder
$asset->clearThumbnail(ThumbnailConfig::getPreviewConfig()->getName());

// system thumbnail format
Expand All @@ -40,7 +40,7 @@ public function __invoke(ThumbnailJob $message)
if (is_object($thumbnailConfig)) {
$asset->clearThumbnail($thumbnailConfig->getName());
$path = $asset->getThumbnail($thumbnailConfig)->getFileSystemPath();
Logger::debug('BTB Generated thumbnail ['.$thumbnailConfigName.'] for asset ID '
Logger::debug('BTB Generated thumbnail ['.$thumbnailConfigName.'] for assetId '
. $message->getAssetId()
. ' Path:' .$path);
}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ GPLv3 - see: gpl-3.0.txt
generating system thumbnails, change `vendor/pimcore/pimcore/models/Asset/Image.php`,
in method `update` the line `$path = $this->getThumbnail(Image\Thumbnail\Config::getPreviewConfig())->getFileSystemPath();` to
`$path = $this->getThumbnail(Image\Thumbnail\Config::getPreviewConfig())->getFileSystemPath(true);`
1) Disable low quality previwew generation:
1) Disable low quality preview generation:
```yaml
# app/config/config.yml - 'pimcore' section:
assets:
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@
},
"autoload": {
"psr-4": {
"Basilicom\\ThumbnailBundle\\": ""
"Basilicom\\ThumbnailBundle\\": "."
},
"exclude-from-classmap": [
"tests",
"Tests"
]
},
"extra": {
"pimcore": {
"bundles": [
"CustomerManagementFrameworkBundle\\PimcoreCustomerManagementFrameworkBundle"
"Basilicom\\ThumbnailBundle\\BasilicomThumbnailBundle"
]
}
}
Expand Down

0 comments on commit 24411ae

Please sign in to comment.