MediaWiki REL1_28
|
PHP script to stream out an image thumbnail. More...
Go to the source code of this file.
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. | |
wfGenerateThumbnail (File $file, array $params, $thumbName, $thumbPath) | |
Actually try to generate a new thumbnail. | |
wfStreamThumb (array $params) | |
Stream a thumbnail specified by parameters. | |
wfThumbError ( $status, $msgHtml, $msgText=null, $context=[]) | |
Output a thumbnail generation error message. | |
wfThumbErrorText ( $status, $msgText) | |
Output a thumbnail generation error message. | |
wfThumbHandle404 () | |
Handle a thumbnail request via thumbnail file URL. | |
Variables | |
$mediawiki = new MediaWiki() | |
$wgTrivialMimeDetection = true | |
if(defined( 'THUMB_HANDLER')) | else |
const | MW_NO_OUTPUT_COMPRESSION 1 |
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.
wfExtractThumbParams | ( | $file, | |
$params | |||
) |
Convert a thumbnail name (122px-foo.png) to parameters, using file handler.
Definition at line 520 of file thumb.php.
References $handler, $matches, $params, list, and wfDeprecated().
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:
Transform specific parameters are set later via wfExtractThumbParams().
string | $thumbRel | Thumbnail path relative to the thumb zone |
Definition at line 481 of file thumb.php.
References $params, list, and RepoGroup\singleton().
Referenced by wfThumbHandle404().
Actually try to generate a new thumbnail.
File | $file | |
array | $params | |
string | $thumbName | |
string | $thumbPath |
Definition at line 384 of file thumb.php.
References $cache, $e, $params, $status, $wgAttemptFailureEpoch, PoolCounterWork\execute(), function, File\getName(), File\getRepo(), File\getSha1(), global, File\isExpensiveToThumbnail(), File\RENDER_NOW, File\transform(), use, and wfMessage().
Referenced by wfStreamThumb().
wfStreamThumb | ( | array | $params | ) |
Stream a thumbnail specified by parameters.
array | $params | 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) |
Definition at line 91 of file thumb.php.
References $e, $params, $response, $starttime, $status, $title, $user, $wgVaryOnXFP, are, based, File\DELETED_FILE, files(), MessageSpecifier\getKey(), RequestContext\getMain(), global, HttpStatus\header(), list, name, NS_FILE, on, PROTO_CURRENT, RepoGroup\singleton(), File\THUMB_FULL_NAME, TS_UNIX, wfExpandUrl(), wfExtractThumbParams(), wfGenerateThumbnail(), wfLocalFile(), wfMessage(), wfThumbError(), wfThumbErrorText(), wfThumbIsStandard(), wfTimestamp(), and will.
Referenced by wfThumbHandle404().
wfThumbError | ( | $status, | |
$msgHtml, | |||
$msgText = null , |
|||
$context = [] |
|||
) |
Output a thumbnail generation error message.
int | $status | |
string | $msgHtml | HTML |
string | $msgText | Short error description, for internal logging. Defaults to $msgHtml. Only used for HTTP 500 errors. |
array | $context | Error context, for internal logging. Only used for HTTP 500 errors. |
Definition at line 592 of file thumb.php.
References $content, $context, $debug, $status, $wgShowHostnames, global, HttpStatus\header(), title, and wfHostname().
Referenced by wfStreamThumb(), wfThumbErrorText(), and wfThumbHandle404().
wfThumbErrorText | ( | $status, | |
$msgText | |||
) |
Output a thumbnail generation error message.
int | $status | |
string | $msgText | Plain text (will be html escaped) |
Definition at line 578 of file thumb.php.
References $status, and wfThumbError().
Referenced by wfStreamThumb().
wfThumbHandle404 | ( | ) |
Handle a thumbnail request via thumbnail file URL.
Definition at line 50 of file thumb.php.
References $matches, $params, $wgArticlePath, global, RepoGroup\singleton(), wfExtractThumbRequestInfo(), wfStreamThumb(), and wfThumbError().
if (defined('THUMB_HANDLER')) else |