MediaWiki  REL1_22
thumb.php File Reference

PHP script to stream out an image thumbnail. More...

Go to the source code of this file.

Enumerations

enum  MW_NO_OUTPUT_COMPRESSION

Functions

 wfExtractThumbParams ($file, $params)
 Convert a thumbnail name (122px-foo.png) to parameters, using file handler.
 wfExtractThumbRequestInfo ($thumbRel)
 Convert pathinfo type parameter, into normal request parameters.
 wfStreamThumb (array $params)
 Stream a thumbnail specified by parameters.
 wfThumbError ($status, $msg)
 Output a thumbnail generation error message.
 wfThumbHandle404 ()
 Handle a thumbnail request via thumbnail file URL.
 wfThumbHandleRequest ()
 Handle a thumbnail request via query parameters.

Variables

 $wgTrivialMimeDetection = true

Detailed Description

PHP script to stream out an image thumbnail.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. http://www.gnu.org/copyleft/gpl.html

Definition in file thumb.php.


Enumeration Type Documentation

Definition at line 24 of file thumb.php.


Function Documentation

wfExtractThumbParams ( file,
params 
)

Convert a thumbnail name (122px-foo.png) to parameters, using file handler.

Parameters:
File$fileFile object for file in question.
$paramArray Array of parameters so far.
Returns:
Array parameters array with more parameters.

Definition at line 400 of file thumb.php.

References $file, $matches, $params, $size, array(), list, wfDeprecated(), and wfRunHooks().

Referenced by wfStreamThumb().

wfExtractThumbRequestInfo ( thumbRel)

Convert pathinfo type parameter, into normal request parameters.

So for example, if the request was redirected from /w/images/thumb/a/ab/Foo.png/120px-Foo.png. The $thumbRel parameter of this function would be set to "a/ab/Foo.png/120px-Foo.png". This method is responsible for turning that into an array with the folowing keys: * f => the filename (Foo.png) * rel404 => the whole thing (a/ab/Foo.png/120px-Foo.png) * archived => 1 (If the request is for an archived thumb) * temp => 1 (If the file is in the "temporary" zone) * thumbName => the thumbnail name, including parameters (120px-Foo.png)

Transform specific parameters are set later via wfExtractThumbParams().

Parameters:
$thumbRelString Thumbnail path relative to the thumb zone
Returns:
Array|null associative params array or null

Definition at line 362 of file thumb.php.

References $params, array(), list, and RepoGroup\singleton().

Referenced by wfThumbHandle404().

wfStreamThumb ( array params)

Stream a thumbnail specified by parameters.

Parameters:
$paramsArray List of thumbnailing parameters. In addition to parameters passed to the MediaHandler, this may also includes the keys: f (for filename), archived (if archived file), temp (if temp file), w (alias for width), p (alias for page), r (ignored; historical), rel404 (path for render on 404 to verify hash path correct), thumbName (thumbnail name to potentially extract more parameters from e.g. 'lossy-page1-120px-Foo.tiff' would add page, lossy and width to the parameters)
Returns:
void

Definition at line 101 of file thumb.php.

References $response, $section, $title, $user, are, array(), based, empty, false, files, User\getGroupPermissions(), MWException\getHTML(), RequestContext\getMain(), HttpStatus\getMessage(), global, however, Title\makeTitleSafe(), name, on, File\RENDER_NOW, RepoGroup\singleton(), text, File\THUMB_FULL_NAME, wfExpandUrl(), wfExtractThumbParams(), wfLocalFile(), wfMessage(), wfRestoreWarnings(), wfSuppressWarnings(), wfThumbError(), wfTimestamp(), and will.

Referenced by wfThumbHandle404(), and wfThumbHandleRequest().

wfThumbError ( status,
msg 
)

Output a thumbnail generation error message.

Parameters:
$statusinteger
$msgstring
Returns:
void

Definition at line 458 of file thumb.php.

References $debug, global, title, and wfHostname().

Referenced by wfStreamThumb(), and wfThumbHandle404().

Handle a thumbnail request via thumbnail file URL.

Returns:
void

Definition at line 60 of file thumb.php.

References $matches, $params, $wgArticlePath, WebRequest\getPathInfo(), global, RepoGroup\singleton(), wfExtractThumbRequestInfo(), wfStreamThumb(), and wfThumbError().

Handle a thumbnail request via query parameters.

Returns:
void

Definition at line 47 of file thumb.php.

References $params, and wfStreamThumb().


Variable Documentation

$wgTrivialMimeDetection = true

Definition at line 28 of file thumb.php.

Referenced by StreamFile\contentTypeFromPath().