BlueSpice MediaWiki REL1_27
 All Classes Namespaces Files Functions Variables Groups Pages
thumb.php File Reference

Functions

 wfThumbHandle404 ()
 
 wfGenerateThumbnail (File $file, array $params, $thumbName, $thumbPath)
 
 wfExtractThumbRequestInfo ($thumbRel)
 
 wfExtractThumbParams ($file, $params)
 
 wfThumbErrorText ($status, $msgText)
 
 wfThumbError ($status, $msgHtml, $msgText=null, $context=[])
 

Variables

const MW_NO_OUTPUT_COMPRESSION 1
 
 $wgTrivialMimeDetection = true
 
if(defined( 'THUMB_HANDLER')) else
 
 $mediawiki = new MediaWiki()
 

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

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
array$paramsArray of parameters so far
Returns
array Parameters array with more parameters
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
string$thumbRelThumbnail path relative to the thumb zone
Returns
array|null Associative params array or null
wfGenerateThumbnail ( File  $file,
array  $params,
  $thumbName,
  $thumbPath 
)

Actually try to generate a new thumbnail

Parameters
File$file
array$params
string$thumbName
string$thumbPath
Returns
array (MediaTransformOutput|bool, string|bool error message HTML)

PhpUnusedLocalVariableInspection

wfThumbError (   $status,
  $msgHtml,
  $msgText = null,
  $context = [] 
)

Output a thumbnail generation error message

Parameters
int$status
string$msgHtmlHTML
string$msgTextShort error description, for internal logging. Defaults to $msgHtml. Only used for HTTP 500 errors.
array$contextError context, for internal logging. Only used for HTTP 500 errors.
Returns
void
wfThumbErrorText (   $status,
  $msgText 
)

Output a thumbnail generation error message

Parameters
int$status
string$msgTextPlain text (will be html escaped)
Returns
void
wfThumbHandle404 ( )

Handle a thumbnail request via thumbnail file URL

Returns
void

Variable Documentation

if (defined( 'THUMB_HANDLER')) else
Initial value:
{
wfStreamThumb( $_GET )