Skip to content

Commit

Permalink
Added the ImageSize plugin.
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel-KM committed Apr 19, 2020
1 parent 74a4321 commit 5c0fb04
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions config/module.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
'tileServer' => Mvc\Controller\Plugin\TileServer::class,
],
'factories' => [
'imageSize' => Service\ControllerPlugin\ImageSizeFactory::class,
'tiler' => Service\ControllerPlugin\TilerFactory::class,
],
],
Expand Down
4 changes: 2 additions & 2 deletions src/Mvc/Controller/Plugin/ImageSize.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php
namespace ImageServer\Mvc\Controller\Plugin;

use Omeka\Api\Representation\AssetRepresentation;
use Omeka\Api\Representation\MediaRepresentation;
use Omeka\File\TempFileFactory;
use Omeka\Mvc\Exception\RuntimeException;
use Omeka\Stdlib\Message;
use Zend\Mvc\Controller\Plugin\AbstractPlugin;
use Omeka\Api\Representation\MediaRepresentation;
use Omeka\Api\Representation\AssetRepresentation;

class ImageSize extends AbstractPlugin
{
Expand Down
16 changes: 16 additions & 0 deletions src/Service/ControllerPlugin/ImageSizeFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php
namespace ImageServer\Service\ControllerPlugin;

use ImageServer\Mvc\Controller\Plugin\ImageSize;
use Interop\Container\ContainerInterface;
use Zend\ServiceManager\Factory\FactoryInterface;

class ImageSizeFactory implements FactoryInterface
{
public function __invoke(ContainerInterface $services, $requestedName, array $options = null)
{
$basePath = $services->get('Config')['file_store']['local']['base_path'] ?: (OMEKA_PATH . '/files');
$tempFileFactory = $services->get('Omeka\File\TempFileFactory');
return new ImageSize($basePath, $tempFileFactory);
}
}

0 comments on commit 5c0fb04

Please sign in to comment.