From: Tim Starling Date: Tue, 10 Jan 2006 14:13:40 +0000 (+0000) Subject: Enforce $wgSVGMaxSize when rendering, even for SVGs with a very large source size... X-Git-Tag: 1.6.0~639 X-Git-Url: http://git.cyclocoop.org/%22.%24h.%22?a=commitdiff_plain;h=db816b1beec74f7b32aea3618ae47f0aa902e164;p=lhc%2Fweb%2Fwiklou.git Enforce $wgSVGMaxSize when rendering, even for SVGs with a very large source size. This is necessary to limit server memory usage. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index e41d96170f..3dc6c274c2 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -452,6 +452,8 @@ fully support the editing toolbar, but was found to be too confusing. * (bug 912) Search box easier to reach in text browsers (lynx, links) * $wgParserCacheExpireTime added * Skip loading of RecentChange.php except where needed +* Enforce $wgSVGMaxSize when rendering, even for SVGs with a very large source + size. This is necessary to limit server memory usage. === Caveats === diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 1f8103db8a..3af615553f 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -1220,7 +1220,7 @@ $wgSVGConverters = array( $wgSVGConverter = 'ImageMagick'; /** If not in the executable PATH, specify */ $wgSVGConverterPath = ''; -/** Don't scale a SVG larger than this unless its native size is larger */ +/** Don't scale a SVG larger than this */ $wgSVGMaxSize = 1024; /** * Don't thumbnail an image if it will use too much working memory diff --git a/includes/Image.php b/includes/Image.php index 6b27f5e3f6..17f3f8cb01 100644 --- a/includes/Image.php +++ b/includes/Image.php @@ -945,11 +945,9 @@ class Image return null; } - $maxsize = $this->mustRender() - ? max( $this->width, $wgSVGMaxSize ) - : $this->width - 1; + # Don't make an image bigger than the source, or wgMaxSVGSize for SVGs + $maxsize = $this->mustRender() ? $wgSVGMaxSize : $this->width - 1; if( $width > $maxsize ) { - # Don't make an image bigger than the source $thumb = new ThumbnailImage( $this->getViewURL(), $this->getWidth(), $this->getHeight() ); wfProfileOut( $fname ); return $thumb;