Skip to content

Commit

Permalink
Update all classes to make use of gallery config
Browse files Browse the repository at this point in the history
  • Loading branch information
mlewis-everley committed May 20, 2014
1 parent d9afe11 commit 4b2f066
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
20 changes: 10 additions & 10 deletions code/config/GalleryConfig.php
Expand Up @@ -60,8 +60,8 @@ class GalleryConfig extends Object {
* @param $height height of the images
*/
public static function setDimensions($width, $height) {
self::$width = $width;
self::$height = $height;
self::config()->width = $width;
self::config()->height = $height;
}

/**
Expand All @@ -71,8 +71,8 @@ public static function setDimensions($width, $height) {
* @param $height height of the images
*/
public static function setThumbDimensions($width, $height) {
self::$thumb_width = $width;
self::$thumb_height = $height;
self::config()->thumb_width = $width;
self::config()->thumb_height = $height;
}

/**
Expand All @@ -81,26 +81,26 @@ public static function setThumbDimensions($width, $height) {
* @param $width width of the images
*/
public static function setResizeType($type) {
self::$resize_type = $type;
self::config()->resize_type = $type;
}

public static function getWidth() {
return self::$width;
return self::config()->width;
}

public static function getHeight() {
return self::$height;
return self::config()->height;
}

public static function getThumbWidth() {
return self::$thumb_width;
return self::config()->thumb_width;
}

public static function getThumbHeight() {
return self::$thumb_height;
return self::config()->thumb_height;
}

public static function getResizeType() {
return self::$resize_type;
return self::config()->resize_type;
}
}
8 changes: 4 additions & 4 deletions code/extensions/GalleryImage.php
Expand Up @@ -11,8 +11,8 @@ public function __construct() {

public function GalleryImage() {
$resize_type = GalleryConfig::getResizeType();
$width = GalleryConfig::getWidth();
$height = GalleryConfig::getHeight();
$width = GalleryConfig::config()->width;
$height = GalleryConfig::config()->height;
$img = false;

switch ($resize_type) {
Expand All @@ -31,8 +31,8 @@ public function GalleryImage() {
}

public function GalleryThumbnail() {
$width = GalleryConfig::getThumbWidth();
$height = GalleryConfig::getThumbHeight();
$width = GalleryConfig::config()->thumb_width;
$height = GalleryConfig::config()->thumb_height;

return $this->owner->croppedImage($width,$height);

Expand Down

0 comments on commit 4b2f066

Please sign in to comment.