MediaWiki  1.23.8
MockImageHandler.php
Go to the documentation of this file.
1 <?php
32 
39  static function doFakeTransform( $that, $image, $dstPath, $dstUrl, $params, $flags = 0 ) {
40  # Example of what we receive:
41  # $image: LocalFile
42  # $dstPath: /tmp/transform_7d0a7a2f1a09-1.jpg
43  # $dstUrl : http://example.com/images/thumb/0/09/Bad.jpg/320px-Bad.jpg
44  # $params: width: 320, descriptionUrl http://trunk.dev/wiki/File:Bad.jpg
45 
46  $that->normaliseParams( $image, $params );
47 
48  $scalerParams = array(
49  # The size to which the image will be resized
50  'physicalWidth' => $params['physicalWidth'],
51  'physicalHeight' => $params['physicalHeight'],
52  'physicalDimensions' => "{$params['physicalWidth']}x{$params['physicalHeight']}",
53  # The size of the image on the page
54  'clientWidth' => $params['width'],
55  'clientHeight' => $params['height'],
56  # Comment as will be added to the EXIF of the thumbnail
57  'comment' => isset( $params['descriptionUrl'] ) ?
58  "File source: {$params['descriptionUrl']}" : '',
59  # Properties of the original image
60  'srcWidth' => $image->getWidth(),
61  'srcHeight' => $image->getHeight(),
62  'mimeType' => $image->getMimeType(),
63  'dstPath' => $dstPath,
64  'dstUrl' => $dstUrl,
65  );
66 
67  # In some cases, we do not bother generating a thumbnail.
68  if ( !$image->mustRender() &&
69  $scalerParams['physicalWidth'] == $scalerParams['srcWidth']
70  && $scalerParams['physicalHeight'] == $scalerParams['srcHeight']
71  ) {
72  wfDebug( __METHOD__ . ": returning unscaled image\n" );
73  // getClientScalingThumbnailImage is protected
74  return $that->doClientImage( $image, $scalerParams );
75  }
76 
77  return new ThumbnailImage( $image, $dstUrl, false, $params );
78  }
79 }
ThumbnailImage
Media transform output for images.
Definition: MediaTransformOutput.php:250
MockImageHandler\doFakeTransform
static doFakeTransform( $that, $image, $dstPath, $dstUrl, $params, $flags=0)
Override BitmapHandler::doTransform() making sure we do not generate a thumbnail at all.
Definition: MockImageHandler.php:39
of
globals txt Globals are evil The original MediaWiki code relied on globals for processing context far too often MediaWiki development since then has been a story of slowly moving context out of global variables and into objects Storing processing context in object member variables allows those objects to be reused in a much more flexible way Consider the elegance of
Definition: globals.txt:10
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
$params
$params
Definition: styleTest.css.php:40
$flags
it s the revision text itself In either if gzip is the revision text is gzipped $flags
Definition: hooks.txt:2113
MockImageHandler
Mock handler for images.
Definition: MockImageHandler.php:31
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
will
</td >< td > &</td >< td > t want your writing to be edited mercilessly and redistributed at will
Definition: All_system_messages.txt:914
wfDebug
wfDebug( $text, $dest='all')
Sends a line to the debug log if enabled or, optionally, to a comment in output.
Definition: GlobalFunctions.php:933
on
We ve cleaned up the code here by removing clumps of infrequently used code and moving them off somewhere else It s much easier for someone working with this code to see what s _really_ going on
Definition: hooks.txt:86
as
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
page
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values my talk page
Definition: hooks.txt:1956