Skip to content

Commit

Permalink
tile format config
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremytubbs committed Nov 20, 2015
1 parent 8e45923 commit f25f59a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Example implementation -
$deepzoom = Jeremytubbs\Deepzoom\DeepzoomFactory::create([
'path' => 'images', // Export path for tiles
'driver' => 'imagick', // Choose between gd and imagick support.
'format' => 'jpg',
]);
// folder, file are optional and will default to filename
$response = $deepzoom->makeTiles('KISS.jpg', 'file', 'folder');
Expand Down
10 changes: 5 additions & 5 deletions src/Deepzoom.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,25 @@
*/
class Deepzoom
{
protected $cache;
protected $source;
protected $path;
protected $imageManager;
protected $tileFormat;

private $tileSize;
private $tileOverlap;
private $tileFormat;


/**
* @param FilesystemInterface $path
* @param ImageManager $imageManager
*/
public function __construct(FilesystemInterface $path, ImageManager $imageManager)
public function __construct(FilesystemInterface $path, ImageManager $imageManager, $tileFormat)
{
$this->setImageManager($imageManager);
$this->setPath($path);
$this->tileSize = 256;
$this->tileOverlap = 1;
$this->tileFormat = 'jpg';
$this->tileFormat = $tileFormat;
}

/**
Expand Down
18 changes: 15 additions & 3 deletions src/DeepzoomFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class DeepzoomFactory
public function __construct(array $config = [])
{
$this->config = $config;
var_dump($config);
}

/**
Expand All @@ -32,7 +33,8 @@ public function getDeepzoom()
{
$deepzoom = new Deepzoom(
$this->getPath(),
$this->getImageManager()
$this->getImageManager(),
$this->getTileFormat()
);

return $deepzoom;
Expand All @@ -52,8 +54,6 @@ public function getPath()
new Local($this->config['path'])
);
}

return $this->config['Path'];
}

/**
Expand All @@ -72,6 +72,18 @@ public function getImageManager()
]);
}

public function getTileFormat()
{
$tileFormat = 'jpg';

if (isset($this->config['format'])) {
$tileFormat = $this->config['format'];
var_dump($tileFormat);
}

return $tileFormat;
}

/**
* @param array $config
* @return Deepzoom
Expand Down

0 comments on commit f25f59a

Please sign in to comment.