diff options
author | mattpiwik <matthieu.aubry@gmail.com> | 2012-06-01 03:05:32 +0400 |
---|---|---|
committer | mattpiwik <matthieu.aubry@gmail.com> | 2012-06-01 03:05:32 +0400 |
commit | 1a3941949f70911a70f9786635a935eb5ef44244 (patch) | |
tree | f93b48f276cc78514b4970c37c21efcf30f20664 /plugins/ImageGraph/API.php | |
parent | 11096695c28e6b50ea0ad473356043f904c9fc1f (diff) |
Cap width/height to safe amount
git-svn-id: http://dev.piwik.org/svn/trunk@6426 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'plugins/ImageGraph/API.php')
-rw-r--r-- | plugins/ImageGraph/API.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/plugins/ImageGraph/API.php b/plugins/ImageGraph/API.php index 8766ecaeb8..8a02667fcd 100644 --- a/plugins/ImageGraph/API.php +++ b/plugins/ImageGraph/API.php @@ -29,6 +29,8 @@ class Piwik_ImageGraph_API const TRUNCATE_KEY = 'truncate'; const WIDTH_KEY = 'width'; const HEIGHT_KEY = 'height'; + const MAX_WIDTH = 1024; + const MAX_HEIGHT = 1024; static private $DEFAULT_PARAMETERS = array( Piwik_ImageGraph_StaticGraph::GRAPH_TYPE_BASIC_LINE => array( @@ -180,11 +182,13 @@ class Piwik_ImageGraph_API { $width = self::$DEFAULT_PARAMETERS[$graphType][self::WIDTH_KEY]; } - if(empty($height)) { $height = self::$DEFAULT_PARAMETERS[$graphType][self::HEIGHT_KEY]; } + // Cap width and height to a safe amount + $width = min($width, self::MAX_WIDTH); + $height = min($height, self::MAX_HEIGHT); if($reportHasDimension) { |