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'] );
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'] ] );
97 if ( !$wgPdfCreateThumbnailsInJobQueue ) {
100 $magic = MediaWiki\MediaWikiServices::getInstance()->getMimeAnalyzer();
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 ]
127 JobQueueGroup::singleton()->push( $jobs );
unserialize( $serialized)
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
$wgImageLimits
Limit images on image description pages to a user-selectable limit.
wfLocalFile( $title)
Get an object referring to a locally registered file.
wfDebugLog( $logGroup, $text, $dest='all', array $context=[])
Send a line to a supplementary debug log file, if configured, or main debug log if not.
run()
Run a thumbnail job on a given PDF file.
const BIG_THUMB
Flags for thumbnail jobs.
__construct( $title, $params)
Construct a thumbnail job.
static insertJobs( $upload, $mime, &$error)
Class to both describe a background job and handle jobs.
array $params
Array of job parameters.
array $metadata
Additional queue metadata.
string $error
Text for error that occurred last.
static makeThumbLinkObj(Title $title, $file, $label='', $alt='', $align='right', $params=[], $framed=false, $manualthumb="")
Make HTML for a thumbnail including image, border and caption.
static getDefaultOption( $opt)
Get a given default option value.