From: Aaron Schulz Date: Fri, 17 Aug 2012 03:23:37 +0000 (-0700) Subject: Don't get local file copies for svg/djvu files unless needed. X-Git-Tag: 1.31.0-rc.0~22709 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/journal.php?a=commitdiff_plain;h=cfbf757b84d825c9fd9250ab74ee18555e2ca208;p=lhc%2Fweb%2Fwiklou.git Don't get local file copies for svg/djvu files unless needed. Change-Id: I80e9cc98ba78effba120d84c5f2edca0b547b61a --- diff --git a/includes/media/DjVu.php b/includes/media/DjVu.php index ed38bd1dab..7ee93a1de7 100644 --- a/includes/media/DjVu.php +++ b/includes/media/DjVu.php @@ -146,7 +146,6 @@ class DjVuHandler extends ImageHandler { } $width = $params['width']; $height = $params['height']; - $srcPath = $image->getLocalRefPath(); $page = $params['page']; if ( $page > $this->pageCount( $image ) ) { return new MediaTransformError( 'thumbnail_error', $width, $height, wfMsg( 'djvu_page_error' ) ); @@ -160,6 +159,7 @@ class DjVuHandler extends ImageHandler { return new MediaTransformError( 'thumbnail_error', $width, $height, wfMsg( 'thumbnail_dest_directory' ) ); } + $srcPath = $image->getLocalRefPath(); # Use a subshell (brackets) to aggregate stderr from both pipeline commands # before redirecting it to the overall stdout. This works in both Linux and Windows XP. $cmd = '(' . wfEscapeShellArg( $wgDjvuRenderer ) . " -format=ppm -page={$page}" . diff --git a/includes/media/SVG.php b/includes/media/SVG.php index 9c8fc5ee09..9846c71da9 100644 --- a/includes/media/SVG.php +++ b/includes/media/SVG.php @@ -108,7 +108,6 @@ class SvgHandler extends ImageHandler { $clientHeight = $params['height']; $physicalWidth = $params['physicalWidth']; $physicalHeight = $params['physicalHeight']; - $srcPath = $image->getLocalRefPath(); if ( $flags & self::TRANSFORM_LATER ) { return new ThumbnailImage( $image, $dstUrl, $clientWidth, $clientHeight, $dstPath ); @@ -119,6 +118,7 @@ class SvgHandler extends ImageHandler { wfMsg( 'thumbnail_dest_directory' ) ); } + $srcPath = $image->getLocalRefPath(); $status = $this->rasterize( $srcPath, $dstPath, $physicalWidth, $physicalHeight ); if( $status === true ) { return new ThumbnailImage( $image, $dstUrl, $clientWidth, $clientHeight, $dstPath );