Go to the documentation of this file.
35 return (
$file->getWidth() &&
$file->getHeight() );
39 return array(
'img_width' =>
'width' );
43 if ( in_array(
$name,
array(
'width',
'height' ) ) ) {
55 if ( isset(
$params[
'physicalWidth'] ) ) {
56 $width =
$params[
'physicalWidth'];
57 } elseif ( isset(
$params[
'width'] ) ) {
60 throw new MWException(
'No width specified to ' . __METHOD__ );
63 # Removed for ProofreadPage
64 #$width = intval( $width );
70 if ( preg_match(
'/^(\d+)px$/', $str, $m ) ) {
71 return array(
'width' => $m[1] );
87 $mimeType = $image->getMimeType();
89 if ( !isset(
$params[
'width'] ) ) {
93 if ( !isset(
$params[
'page'] ) ) {
97 if (
$params[
'page'] > $image->pageCount() ) {
98 $params[
'page'] = $image->pageCount();
106 $srcWidth = $image->getWidth(
$params[
'page'] );
107 $srcHeight = $image->getHeight(
$params[
'page'] );
110 # Height & width were both set
111 if (
$params[
'width'] * $srcHeight >
$params[
'height'] * $srcWidth ) {
112 # Height is the relative smaller dimension, so scale width accordingly
116 # Very small image, so we need to rely on client side scaling :(
122 # Height was crap, unset it so that it will be calculated later
127 if ( !isset(
$params[
'physicalWidth'] ) ) {
128 # Passed all validations, so set the physicalWidth
132 # Because thumbs are only referred to by width, the height always needs
133 # to be scaled by the width to keep the thumbnail sizes consistent,
134 # even if it was set inside the if block above
138 # Set the height if it was not validated in the if block higher up
144 $params[
'physicalHeight'], $srcWidth, $srcHeight, $mimeType )
163 $width = intval( $width );
165 # Sanity check $width
167 wfDebug( __METHOD__ .
": Invalid destination width: $width\n" );
171 if ( $srcWidth <= 0 ) {
172 wfDebug( __METHOD__ .
": Invalid source width: $srcWidth\n" );
178 if ( $height == 0 ) {
179 # Force height to be at least 1 pixel
198 if ( $image->mustRender() ||
$params[
'width'] < $image->getWidth() ) {
205 $gis = getimagesize(
$path );
221 return $image->getWidth() * $image->getHeight();
230 $nbytes = htmlspecialchars(
$wgLang->formatSize(
$file->getSize() ) );
231 $widthheight =
wfMessage(
'widthheight' )
232 ->numParams(
$file->getWidth(),
$file->getHeight() )->escaped();
234 return "$widthheight ($nbytes)";
243 $pages =
$file->pageCount();
245 if ( $pages ===
false || $pages <= 1 ) {
246 $msg =
wfMessage(
'file-info-size' )->numParams(
$file->getWidth(),
248 $file->getMimeType() )->parse();
250 $msg =
wfMessage(
'file-info-size-pages' )->numParams(
$file->getWidth(),
252 $file->getMimeType() )->numParams( $pages )->parse();
263 $pages =
$file->pageCount();
266 ->numParams(
$file->getWidth(),
$file->getHeight(), $pages )->
text();
validateParam( $name, $value)
Validate a thumbnail parameter at parse time.
Media transform output for images.
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
parseParamString( $str)
Parse a param string made with makeParamString back into an array.
getScriptParams( $params)
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
wfSuppressWarnings( $end=false)
Reference-counted warning suppression.
getParamMap()
Get an associative array mapping magic word IDs to parameter names.
wfAppendQuery( $url, $query)
Append a query string to an existing URL, which may or may not already have query string parameters a...
wfRestoreWarnings()
Restore error level to previous value.
Media handler abstract base class for images.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing after in associative array form externallinks including delete and has completed for all link tables default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "<
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
when a variable name is used in a it is silently declared as a new masking the global
validateThumbParams(&$width, &$height, $srcWidth, $srcHeight, $mimeType)
Validate thumbnail parameters and fill in the correct height.
getDimensionsString( $file)
normaliseParams( $image, &$params)
wfDebug( $text, $dest='all')
Sends a line to the debug log if enabled or, optionally, to a comment in output.
Allows to change the fields on the form that will be generated $name
static scaleHeight( $srcWidth, $srcHeight, $dstWidth)
Calculate the height of a thumbnail using the source and destination width.
if(PHP_SAPI !='cli') $file
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as $wgLang
makeParamString( $params)
Merge a parameter array into a string appropriate for inclusion in filenames.
getImageSize( $image, $path)
Get an image size array like that returned by getimagesize(), or false if it can't be determined.
getScriptedTransform( $image, $script, $params)
getImageArea( $image)
Function that returns the number of pixels to be thumbnailed.