Go to the documentation of this file.
21 parent::__construct(
'createPdfThumbnailsJob',
$title,
$params );
28 public function run() {
29 if ( !isset( $this->params[
'page'] ) ) {
30 wfDebugLog(
'thumbnails',
'A page for thumbnails job of ' . $this->title->getText() .
31 ' was not specified! That should never happen!' );
40 switch ( $this->params[
'jobtype'] ) {
57 $width_orig =
$file->getWidth( $this->params[
'page'] );
59 $height_orig =
$file->getHeight( $this->params[
'page'] );
60 $height = $height_orig;
61 if ( $width > $maxWidth || $height > $maxHeight ) {
64 if ( $width / $height >= $maxWidth / $maxHeight ) {
69 $newwidth = floor( $width * $maxHeight / $height );
75 $transformParams = [
'page' => $this->params[
'page'],
'width' => $width ];
76 $file->transform( $transformParams );
82 [
'page' => $this->params[
'page'] ] );
96 global $wgPdfCreateThumbnailsInJobQueue;
97 if ( !$wgPdfCreateThumbnailsInJobQueue ) {
101 if ( !$magic->isMatchingExtension(
'pdf', $mime ) ) {
105 $title = $upload->getTitle();
106 $uploadFile = $upload->getLocalFile();
107 if ( is_null( $uploadFile ) ) {
108 wfDebugLog(
'thumbnails',
'$uploadFile seems to be null, should never happen...' );
114 $pages = intval( $unserialized[
'Pages'] );
117 for ( $i = 1; $i <= $pages; $i++ ) {
120 [
'page' => $i,
'jobtype' => self::BIG_THUMB ]
124 [
'page' => $i,
'jobtype' => self::SMALL_THUMB ]
static getDefaultOption( $opt)
Get a given default option value.
run()
Run a thumbnail job on a given PDF file.
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
Item class for a filearchive table row.
static insertJobs( $upload, $mime, &$error)
static makeThumbLinkObj(LinkTarget $title, $file, $label='', $alt='', $align='right', $params=[], $framed=false, $manualthumb="")
Make HTML for a thumbnail including image, border and caption.
array $params
Array of job parameters.
const BIG_THUMB
Flags for thumbnail jobs.
wfDebugLog( $logGroup, $text, $dest='all', array $context=[])
Send a line to a supplementary debug log file, if configured, or main debug log if not.
Class to both describe a background job and handle jobs.
string $error
Text for error that occurred last.
array $metadata
Additional queue metadata.
unserialize( $serialized)
$wgImageLimits
Limit images on image description pages to a user-selectable limit.
__construct( $title, $params)
Construct a thumbnail job.
static singleton( $domain=false)
wfLocalFile( $title)
Get an object referring to a locally registered file.