r60175 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60174‎ | r60175 | r60176 >
Date:20:25, 17 December 2009
Author:raymond
Status:ok
Tags:
Comment:
* (bug 19791) Add URL of file source as comment to thumbs (for ImageMagick)
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/filerepo/File.php (modified) (history)
  • /trunk/phase3/includes/media/Bitmap.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/filerepo/File.php
@@ -529,7 +529,7 @@
530530 * @return MediaTransformOutput
531531 */
532532 function transform( $params, $flags = 0 ) {
533 - global $wgUseSquid, $wgIgnoreImageErrors, $wgThumbnailEpoch;
 533+ global $wgUseSquid, $wgIgnoreImageErrors, $wgThumbnailEpoch, $wgServer;
534534
535535 wfProfileIn( __METHOD__ );
536536 do {
@@ -539,6 +539,12 @@
540540 break;
541541 }
542542
 543+ // Get the descriptionUrl to embed it as comment into the thumbnail. Bug 19791.
 544+ $descriptionUrl = $this->getDescriptionUrl();
 545+ if ( $descriptionUrl ) {
 546+ $params['descriptionUrl'] = $wgServer . $descriptionUrl;
 547+ }
 548+
543549 $script = $this->getTransformScript();
544550 if ( $script && !($flags & self::RENDER_NOW) ) {
545551 // Use a script to transform on client request, if possible
Index: trunk/phase3/includes/media/Bitmap.php
@@ -60,6 +60,7 @@
6161 $physicalHeight = $params['physicalHeight'];
6262 $clientWidth = $params['width'];
6363 $clientHeight = $params['height'];
 64+ $descriptionUrl = $params['descriptionUrl'];
6465 $srcWidth = $image->getWidth();
6566 $srcHeight = $image->getHeight();
6667 $mimeType = $image->getMimeType();
@@ -154,6 +155,7 @@
155156 // or ImageMagick may decide your ratio is wrong and slice off
156157 // a pixel.
157158 " -thumbnail " . wfEscapeShellArg( "{$physicalWidth}x{$physicalHeight}!" ) .
 159+ " -set comment " . wfEscapeShellArg( "File source: {$descriptionUrl}" ) .
158160 " -depth 8 $sharpen " .
159161 wfEscapeShellArg($dstPath) . " 2>&1";
160162 wfDebug( __METHOD__.": running ImageMagick: $cmd\n");
Index: trunk/phase3/RELEASE-NOTES
@@ -298,6 +298,7 @@
299299 * (bug 21574) Redirects can now have "303 See Other" HTTP status
300300 * EditPage refactored to allow extensions to derive new edit modes much easier.
301301 * (bug 21826) Subsections of Special:Version now also have anchors
 302+* (bug 19791) Add URL of file source as comment to thumbs (for ImageMagick)
302303
303304 === Bug fixes in 1.16 ===
304305

Follow-up revisions

RevisionCommit summaryAuthorDate
r60188Follow-up r60175: Avoid PHP Notice: Undefined index: descriptionUrl in /var/w...raymond22:54, 17 December 2009

Status & tagging log