diff --git a/configs/AppConfig.inc b/configs/AppConfig.inc index 29872845..cbc7a2f3 100644 --- a/configs/AppConfig.inc +++ b/configs/AppConfig.inc @@ -85,8 +85,12 @@ */ public static $media = array( 'questgroup' => array( - 'width' => 480, - 'height' => 5000 + 'width' => 480, + 'height' => 5000 + ), + 'quest' => array( + 'width' => 200, + 'height' => 200 ), 'avatar' => array( 'width' => 500, diff --git a/controllers/MediaController.inc b/controllers/MediaController.inc index 3261028e..84818c0c 100644 --- a/controllers/MediaController.inc +++ b/controllers/MediaController.inc @@ -473,54 +473,32 @@ // Load and process file $file = null; - switch($action) + if(is_null($action) || !in_array(strtoupper($format), self::getImageTypes())) { - // No action - case null: - // Do not process the file - $file = file_get_contents($media['filename']); - break; - case 'questgroup': - if(!in_array(strtoupper($format), self::getImageTypes())) { - $file = file_get_contents($media['filename']); - } - else - { + // Do not process the file + $file = file_get_contents($media['filename']); + } + else + { + // Process file + switch($action) + { + case 'questgroup': + case 'quest': + case 'avatar': + case 'charactergroup': + case 'charactergroupsquest': $file = self::resizeImage( $media['filename'], $format, - \nre\configs\AppConfig::$media['questgroup']['width'], - \nre\configs\AppConfig::$media['questgroup']['height'] + \nre\configs\AppConfig::$media[$action]['width'], + \nre\configs\AppConfig::$media[$action]['height'] ); - } - break; - case 'avatar': - $file = self::resizeImage( - $media['filename'], - $format, - \nre\configs\AppConfig::$media['avatar']['width'], - \nre\configs\AppConfig::$media['avatar']['height'] - ); - break; - case 'charactergroup': - $file = self::resizeImage( - $media['filename'], - $format, - \nre\configs\AppConfig::$media['charactergroup']['width'], - \nre\configs\AppConfig::$media['charactergroup']['height'] - ); - break; - case 'charactergroupsquest': - $file = self::resizeImage( - $media['filename'], - $format, - \nre\configs\AppConfig::$media['charactergroupsquest']['width'], - \nre\configs\AppConfig::$media['charactergroupsquest']['height'] - ); - break; - default: - throw new ParamsNotValidException($action); - break; + break; + default: + throw new ParamsNotValidException($action); + break; + } } diff --git a/views/html/quests/quest.tpl b/views/html/quests/quest.tpl index c11bb2ed..2e546254 100644 --- a/views/html/quests/quest.tpl +++ b/views/html/quests/quest.tpl @@ -19,10 +19,10 @@
@@ -85,7 +85,7 @@