From: Raimond Spekking Date: Thu, 17 Dec 2009 20:25:55 +0000 (+0000) Subject: * (bug 19791) Add URL of file source as comment to thumbs (for ImageMagick) X-Git-Tag: 1.31.0-rc.0~38511 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/comptes/ajouter.php?a=commitdiff_plain;h=c690e3c2afedaa5ffd36d2023d24bde18afe8380;p=lhc%2Fweb%2Fwiklou.git * (bug 19791) Add URL of file source as comment to thumbs (for ImageMagick) --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 815009a012..e1502f9801 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -298,6 +298,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 21574) Redirects can now have "303 See Other" HTTP status * EditPage refactored to allow extensions to derive new edit modes much easier. * (bug 21826) Subsections of Special:Version now also have anchors +* (bug 19791) Add URL of file source as comment to thumbs (for ImageMagick) === Bug fixes in 1.16 === diff --git a/includes/filerepo/File.php b/includes/filerepo/File.php index a6169e3ea5..d79a166160 100644 --- a/includes/filerepo/File.php +++ b/includes/filerepo/File.php @@ -529,7 +529,7 @@ abstract class File { * @return MediaTransformOutput */ function transform( $params, $flags = 0 ) { - global $wgUseSquid, $wgIgnoreImageErrors, $wgThumbnailEpoch; + global $wgUseSquid, $wgIgnoreImageErrors, $wgThumbnailEpoch, $wgServer; wfProfileIn( __METHOD__ ); do { @@ -539,6 +539,12 @@ abstract class File { break; } + // Get the descriptionUrl to embed it as comment into the thumbnail. Bug 19791. + $descriptionUrl = $this->getDescriptionUrl(); + if ( $descriptionUrl ) { + $params['descriptionUrl'] = $wgServer . $descriptionUrl; + } + $script = $this->getTransformScript(); if ( $script && !($flags & self::RENDER_NOW) ) { // Use a script to transform on client request, if possible diff --git a/includes/media/Bitmap.php b/includes/media/Bitmap.php index d4a7c35f89..ddbf33ed88 100644 --- a/includes/media/Bitmap.php +++ b/includes/media/Bitmap.php @@ -60,6 +60,7 @@ class BitmapHandler extends ImageHandler { $physicalHeight = $params['physicalHeight']; $clientWidth = $params['width']; $clientHeight = $params['height']; + $descriptionUrl = $params['descriptionUrl']; $srcWidth = $image->getWidth(); $srcHeight = $image->getHeight(); $mimeType = $image->getMimeType(); @@ -154,6 +155,7 @@ class BitmapHandler extends ImageHandler { // or ImageMagick may decide your ratio is wrong and slice off // a pixel. " -thumbnail " . wfEscapeShellArg( "{$physicalWidth}x{$physicalHeight}!" ) . + " -set comment " . wfEscapeShellArg( "File source: {$descriptionUrl}" ) . " -depth 8 $sharpen " . wfEscapeShellArg($dstPath) . " 2>&1"; wfDebug( __METHOD__.": running ImageMagick: $cmd\n");