Skip to content

Commit

Permalink
Pass the gallery's key image to the generator.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Apr 21, 2014
1 parent 4f3ea6f commit abe0ab5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ansel/lib/Gallery.php
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,8 @@ public function countImages($subgalleries = false)
*/
public function getKeyImage(Ansel_Style $style = null)
{
global $injector;

if (is_null($style)) {
$style = $this->getStyle();
}
Expand All @@ -755,7 +757,8 @@ public function getKeyImage(Ansel_Style $style = null)
}

// Don't already have one, must generate it.
$params = array('gallery' => $this, 'style' => $style);
$default = $this->getKeyImage(Ansel::getStyleDefinition('ansel_default'));
$params = array('gallery' => $this, 'style' => $style, 'image' => $injector->getInstance('Ansel_Storage')->getImage($default));
try {
$iview = Ansel_ImageGenerator::factory($style->keyimage_type, $params);
$img = $iview->create();
Expand Down

0 comments on commit abe0ab5

Please sign in to comment.