Generate thumbnails based on buckets
[lhc/web/wiklou.git] / includes / media / MediaHandler.php
1 <?php
2 /**
3 * Media-handling base classes and generic functionality.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
19 *
20 * @file
21 * @ingroup Media
22 */
23
24 /**
25 * Base media handler class
26 *
27 * @ingroup Media
28 */
29 abstract class MediaHandler {
30 const TRANSFORM_LATER = 1;
31 const METADATA_GOOD = true;
32 const METADATA_BAD = false;
33 const METADATA_COMPATIBLE = 2; // for old but backwards compatible.
34 /**
35 * Max length of error logged by logErrorForExternalProcess()
36 */
37 const MAX_ERR_LOG_SIZE = 65535;
38
39 /** @var MediaHandler[] Instance cache with array of MediaHandler */
40 protected static $handlers = array();
41
42 /**
43 * Get a MediaHandler for a given MIME type from the instance cache
44 *
45 * @param string $type
46 * @return MediaHandler
47 */
48 static function getHandler( $type ) {
49 global $wgMediaHandlers;
50 if ( !isset( $wgMediaHandlers[$type] ) ) {
51 wfDebug( __METHOD__ . ": no handler found for $type.\n" );
52
53 return false;
54 }
55 $class = $wgMediaHandlers[$type];
56 if ( !isset( self::$handlers[$class] ) ) {
57 self::$handlers[$class] = new $class;
58 if ( !self::$handlers[$class]->isEnabled() ) {
59 self::$handlers[$class] = false;
60 }
61 }
62
63 return self::$handlers[$class];
64 }
65
66 /**
67 * Get an associative array mapping magic word IDs to parameter names.
68 * Will be used by the parser to identify parameters.
69 */
70 abstract function getParamMap();
71
72 /**
73 * Validate a thumbnail parameter at parse time.
74 * Return true to accept the parameter, and false to reject it.
75 * If you return false, the parser will do something quiet and forgiving.
76 *
77 * @param string $name
78 * @param mixed $value
79 */
80 abstract function validateParam( $name, $value );
81
82 /**
83 * Merge a parameter array into a string appropriate for inclusion in filenames
84 *
85 * @param array $params Array of parameters that have been through normaliseParams.
86 * @return string
87 */
88 abstract function makeParamString( $params );
89
90 /**
91 * Parse a param string made with makeParamString back into an array
92 *
93 * @param string $str The parameter string without file name (e.g. 122px)
94 * @return array|bool Array of parameters or false on failure.
95 */
96 abstract function parseParamString( $str );
97
98 /**
99 * Changes the parameter array as necessary, ready for transformation.
100 * Should be idempotent.
101 * Returns false if the parameters are unacceptable and the transform should fail
102 * @param File $image
103 * @param array $params
104 */
105 abstract function normaliseParams( $image, &$params );
106
107 /**
108 * Get an image size array like that returned by getimagesize(), or false if it
109 * can't be determined.
110 *
111 * @param File $image The image object, or false if there isn't one
112 * @param string $path the filename
113 * @return array Follow the format of PHP getimagesize() internal function.
114 * See http://www.php.net/getimagesize
115 */
116 abstract function getImageSize( $image, $path );
117
118 /**
119 * Get handler-specific metadata which will be saved in the img_metadata field.
120 *
121 * @param File $image The image object, or false if there isn't one.
122 * Warning, FSFile::getPropsFromPath might pass an (object)array() instead (!)
123 * @param string $path The filename
124 * @return string
125 */
126 function getMetadata( $image, $path ) {
127 return '';
128 }
129
130 /**
131 * Get metadata version.
132 *
133 * This is not used for validating metadata, this is used for the api when returning
134 * metadata, since api content formats should stay the same over time, and so things
135 * using ForiegnApiRepo can keep backwards compatibility
136 *
137 * All core media handlers share a common version number, and extensions can
138 * use the GetMetadataVersion hook to append to the array (they should append a unique
139 * string so not to get confusing). If there was a media handler named 'foo' with metadata
140 * version 3 it might add to the end of the array the element 'foo=3'. if the core metadata
141 * version is 2, the end version string would look like '2;foo=3'.
142 *
143 * @return string Version string
144 */
145 static function getMetadataVersion() {
146 $version = array( '2' ); // core metadata version
147 wfRunHooks( 'GetMetadataVersion', array( &$version ) );
148
149 return implode( ';', $version );
150 }
151
152 /**
153 * Convert metadata version.
154 *
155 * By default just returns $metadata, but can be used to allow
156 * media handlers to convert between metadata versions.
157 *
158 * @param string|array $metadata Metadata array (serialized if string)
159 * @param int $version Target version
160 * @return array Serialized metadata in specified version, or $metadata on fail.
161 */
162 function convertMetadataVersion( $metadata, $version = 1 ) {
163 if ( !is_array( $metadata ) ) {
164
165 //unserialize to keep return parameter consistent.
166 wfSuppressWarnings();
167 $ret = unserialize( $metadata );
168 wfRestoreWarnings();
169
170 return $ret;
171 }
172
173 return $metadata;
174 }
175
176 /**
177 * Get a string describing the type of metadata, for display purposes.
178 * @param File $image
179 * @return string
180 */
181 function getMetadataType( $image ) {
182 return false;
183 }
184
185 /**
186 * Check if the metadata string is valid for this handler.
187 * If it returns MediaHandler::METADATA_BAD (or false), Image
188 * will reload the metadata from the file and update the database.
189 * MediaHandler::METADATA_GOOD for if the metadata is a-ok,
190 * MediaHanlder::METADATA_COMPATIBLE if metadata is old but backwards
191 * compatible (which may or may not trigger a metadata reload).
192 * @param File $image
193 * @param array $metadata
194 * @return bool
195 */
196 function isMetadataValid( $image, $metadata ) {
197 return self::METADATA_GOOD;
198 }
199
200 /**
201 * Get an array of standard (FormatMetadata type) metadata values.
202 *
203 * The returned data is largely the same as that from getMetadata(),
204 * but formatted in a standard, stable, handler-independent way.
205 * The idea being that some values like ImageDescription or Artist
206 * are universal and should be retrievable in a handler generic way.
207 *
208 * The specific properties are the type of properties that can be
209 * handled by the FormatMetadata class. These values are exposed to the
210 * user via the filemetadata parser function.
211 *
212 * Details of the response format of this function can be found at
213 * https://www.mediawiki.org/wiki/Manual:File_metadata_handling
214 * tl/dr: the response is an associative array of
215 * properties keyed by name, but the value can be complex. You probably
216 * want to call one of the FormatMetadata::flatten* functions on the
217 * property values before using them, or call
218 * FormatMetadata::getFormattedData() on the full response array, which
219 * transforms all values into prettified, human-readable text.
220 *
221 * Subclasses overriding this function must return a value which is a
222 * valid API response fragment (all associative array keys are valid
223 * XML tagnames).
224 *
225 * Note, if the file simply has no metadata, but the handler supports
226 * this interface, it should return an empty array, not false.
227 *
228 * @param File $file
229 * @return array|bool False if interface not supported
230 * @since 1.23
231 */
232 public function getCommonMetaArray( File $file ) {
233 return false;
234 }
235
236 /**
237 * Get a MediaTransformOutput object representing an alternate of the transformed
238 * output which will call an intermediary thumbnail assist script.
239 *
240 * Used when the repository has a thumbnailScriptUrl option configured.
241 *
242 * Return false to fall back to the regular getTransform().
243 * @param File $image
244 * @param string $script
245 * @param array $params
246 * @return bool|ThumbnailImage
247 */
248 function getScriptedTransform( $image, $script, $params ) {
249 return false;
250 }
251
252 /**
253 * Get a MediaTransformOutput object representing the transformed output. Does not
254 * actually do the transform.
255 *
256 * @param File $image The image object
257 * @param string $dstPath Filesystem destination path
258 * @param string $dstUrl Destination URL to use in output HTML
259 * @param array $params Arbitrary set of parameters validated by $this->validateParam()
260 * @return MediaTransformOutput
261 */
262 final function getTransform( $image, $dstPath, $dstUrl, $params ) {
263 return $this->doTransform( $image, $dstPath, $dstUrl, $params, self::TRANSFORM_LATER );
264 }
265
266 /**
267 * Get a MediaTransformOutput object representing the transformed output. Does the
268 * transform unless $flags contains self::TRANSFORM_LATER.
269 *
270 * @param File $image The image object
271 * @param string $dstPath Filesystem destination path
272 * @param string $dstUrl Destination URL to use in output HTML
273 * @param array $params Arbitrary set of parameters validated by $this->validateParam()
274 * Note: These parameters have *not* gone through $this->normaliseParams()
275 * @param int $flags A bitfield, may contain self::TRANSFORM_LATER
276 * @return MediaTransformOutput
277 */
278 abstract function doTransform( $image, $dstPath, $dstUrl, $params, $flags = 0 );
279
280 /**
281 * Get the thumbnail extension and MIME type for a given source MIME type
282 *
283 * @param string $ext Extension of original file
284 * @param string $mime MIME type of original file
285 * @param array $params Handler specific rendering parameters
286 * @return array thumbnail extension and MIME type
287 */
288 function getThumbType( $ext, $mime, $params = null ) {
289 $magic = MimeMagic::singleton();
290 if ( !$ext || $magic->isMatchingExtension( $ext, $mime ) === false ) {
291 // The extension is not valid for this mime type and we do
292 // recognize the mime type
293 $extensions = $magic->getExtensionsForType( $mime );
294 if ( $extensions ) {
295 return array( strtok( $extensions, ' ' ), $mime );
296 }
297 }
298
299 // The extension is correct (true) or the mime type is unknown to
300 // MediaWiki (null)
301 return array( $ext, $mime );
302 }
303
304 /**
305 * Get useful response headers for GET/HEAD requests for a file with the given metadata
306 *
307 * @param mixed $metadata Result of the getMetadata() function of this handler for a file
308 * @return array
309 */
310 public function getStreamHeaders( $metadata ) {
311 return array();
312 }
313
314 /**
315 * True if the handled types can be transformed
316 *
317 * @param File $file
318 * @return bool
319 */
320 function canRender( $file ) {
321 return true;
322 }
323
324 /**
325 * True if handled types cannot be displayed directly in a browser
326 * but can be rendered
327 *
328 * @param File $file
329 * @return bool
330 */
331 function mustRender( $file ) {
332 return false;
333 }
334
335 /**
336 * True if the type has multi-page capabilities
337 *
338 * @param File $file
339 * @return bool
340 */
341 function isMultiPage( $file ) {
342 return false;
343 }
344
345 /**
346 * Page count for a multi-page document, false if unsupported or unknown
347 *
348 * @param File $file
349 * @return bool
350 */
351 function pageCount( $file ) {
352 return false;
353 }
354
355 /**
356 * The material is vectorized and thus scaling is lossless
357 *
358 * @param File $file
359 * @return bool
360 */
361 function isVectorized( $file ) {
362 return false;
363 }
364
365 /**
366 * The material is an image, and is animated.
367 * In particular, video material need not return true.
368 * @note Before 1.20, this was a method of ImageHandler only
369 *
370 * @param File $file
371 * @return bool
372 */
373 function isAnimatedImage( $file ) {
374 return false;
375 }
376
377 /**
378 * If the material is animated, we can animate the thumbnail
379 * @since 1.20
380 *
381 * @param File $file
382 * @return bool If material is not animated, handler may return any value.
383 */
384 function canAnimateThumbnail( $file ) {
385 return true;
386 }
387
388 /**
389 * False if the handler is disabled for all files
390 * @return bool
391 */
392 function isEnabled() {
393 return true;
394 }
395
396 /**
397 * Get an associative array of page dimensions
398 * Currently "width" and "height" are understood, but this might be
399 * expanded in the future.
400 * Returns false if unknown.
401 *
402 * It is expected that handlers for paged media (e.g. DjVuHandler)
403 * will override this method so that it gives the correct results
404 * for each specific page of the file, using the $page argument.
405 *
406 * @note For non-paged media, use getImageSize.
407 *
408 * @param File $image
409 * @param int $page What page to get dimensions of
410 * @return array|bool
411 */
412 function getPageDimensions( $image, $page ) {
413 $gis = $this->getImageSize( $image, $image->getLocalRefPath() );
414 if ( $gis ) {
415 return array(
416 'width' => $gis[0],
417 'height' => $gis[1]
418 );
419 } else {
420 return false;
421 }
422 }
423
424 /**
425 * Generic getter for text layer.
426 * Currently overloaded by PDF and DjVu handlers
427 * @param File $image
428 * @param int $page Page number to get information for
429 * @return bool|string Page text or false when no text found or if
430 * unsupported.
431 */
432 function getPageText( $image, $page ) {
433 return false;
434 }
435
436 /**
437 * Get the text of the entire document.
438 * @param File $file
439 * @return bool|string The text of the document or false if unsupported.
440 */
441 public function getEntireText( File $file ) {
442 $numPages = $file->pageCount();
443 if ( !$numPages ) {
444 // Not a multipage document
445 return $this->getPageText( $file, 1 );
446 }
447 $document = '';
448 for ( $i = 1; $i <= $numPages; $i++ ) {
449 $curPage = $this->getPageText( $file, $i );
450 if ( is_string( $curPage ) ) {
451 $document .= $curPage . "\n";
452 }
453 }
454 if ( $document !== '' ) {
455 return $document;
456 }
457 return false;
458 }
459
460 /**
461 * Get an array structure that looks like this:
462 *
463 * array(
464 * 'visible' => array(
465 * 'Human-readable name' => 'Human readable value',
466 * ...
467 * ),
468 * 'collapsed' => array(
469 * 'Human-readable name' => 'Human readable value',
470 * ...
471 * )
472 * )
473 * The UI will format this into a table where the visible fields are always
474 * visible, and the collapsed fields are optionally visible.
475 *
476 * The function should return false if there is no metadata to display.
477 */
478
479 /**
480 * @todo FIXME: This interface is not very flexible. The media handler
481 * should generate HTML instead. It can do all the formatting according
482 * to some standard. That makes it possible to do things like visual
483 * indication of grouped and chained streams in ogg container files.
484 * @param File $image
485 * @return array|bool
486 */
487 function formatMetadata( $image ) {
488 return false;
489 }
490
491 /** sorts the visible/invisible field.
492 * Split off from ImageHandler::formatMetadata, as used by more than
493 * one type of handler.
494 *
495 * This is used by the media handlers that use the FormatMetadata class
496 *
497 * @param array $metadataArray Metadata array
498 * @return array Array for use displaying metadata.
499 */
500 function formatMetadataHelper( $metadataArray ) {
501 $result = array(
502 'visible' => array(),
503 'collapsed' => array()
504 );
505
506 $formatted = FormatMetadata::getFormattedData( $metadataArray );
507 // Sort fields into visible and collapsed
508 $visibleFields = $this->visibleMetadataFields();
509 foreach ( $formatted as $name => $value ) {
510 $tag = strtolower( $name );
511 self::addMeta( $result,
512 in_array( $tag, $visibleFields ) ? 'visible' : 'collapsed',
513 'exif',
514 $tag,
515 $value
516 );
517 }
518
519 return $result;
520 }
521
522 /**
523 * Get a list of metadata items which should be displayed when
524 * the metadata table is collapsed.
525 *
526 * @return array Array of strings
527 */
528 protected function visibleMetadataFields() {
529 return FormatMetadata::getVisibleFields();
530 }
531
532 /**
533 * This is used to generate an array element for each metadata value
534 * That array is then used to generate the table of metadata values
535 * on the image page
536 *
537 * @param array &$array An array containing elements for each type of visibility
538 * and each of those elements being an array of metadata items. This function adds
539 * a value to that array.
540 * @param string $visibility ('visible' or 'collapsed') if this value is hidden
541 * by default.
542 * @param string $type Type of metadata tag (currently always 'exif')
543 * @param string $id The name of the metadata tag (like 'artist' for example).
544 * its name in the table displayed is the message "$type-$id" (Ex exif-artist ).
545 * @param string $value Thingy goes into a wikitext table; it used to be escaped but
546 * that was incompatible with previous practise of customized display
547 * with wikitext formatting via messages such as 'exif-model-value'.
548 * So the escaping is taken back out, but generally this seems a confusing
549 * interface.
550 * @param bool|string $param Value to pass to the message for the name of the field
551 * as $1. Currently this parameter doesn't seem to ever be used.
552 *
553 * Note, everything here is passed through the parser later on (!)
554 */
555 protected static function addMeta( &$array, $visibility, $type, $id, $value, $param = false ) {
556 $msg = wfMessage( "$type-$id", $param );
557 if ( $msg->exists() ) {
558 $name = $msg->text();
559 } else {
560 // This is for future compatibility when using instant commons.
561 // So as to not display as ugly a name if a new metadata
562 // property is defined that we don't know about
563 // (not a major issue since such a property would be collapsed
564 // by default).
565 wfDebug( __METHOD__ . ' Unknown metadata name: ' . $id . "\n" );
566 $name = wfEscapeWikiText( $id );
567 }
568 $array[$visibility][] = array(
569 'id' => "$type-$id",
570 'name' => $name,
571 'value' => $value
572 );
573 }
574
575 /**
576 * Short description. Shown on Special:Search results.
577 *
578 * @param File $file
579 * @return string
580 */
581 function getShortDesc( $file ) {
582 return self::getGeneralShortDesc( $file );
583 }
584
585 /**
586 * Long description. Shown under image on image description page surounded by ().
587 *
588 * @param File $file
589 * @return string
590 */
591 function getLongDesc( $file ) {
592 return self::getGeneralLongDesc( $file );
593 }
594
595 /**
596 * Used instead of getShortDesc if there is no handler registered for file.
597 *
598 * @param File $file
599 * @return string
600 */
601 static function getGeneralShortDesc( $file ) {
602 global $wgLang;
603
604 return htmlspecialchars( $wgLang->formatSize( $file->getSize() ) );
605 }
606
607 /**
608 * Used instead of getLongDesc if there is no handler registered for file.
609 *
610 * @param File $file
611 * @return string
612 */
613 static function getGeneralLongDesc( $file ) {
614 return wfMessage( 'file-info' )->sizeParams( $file->getSize() )
615 ->params( $file->getMimeType() )->parse();
616 }
617
618 /**
619 * Calculate the largest thumbnail width for a given original file size
620 * such that the thumbnail's height is at most $maxHeight.
621 * @param int $boxWidth Width of the thumbnail box.
622 * @param int $boxHeight Height of the thumbnail box.
623 * @param int $maxHeight Maximum height expected for the thumbnail.
624 * @return int
625 */
626 public static function fitBoxWidth( $boxWidth, $boxHeight, $maxHeight ) {
627 $idealWidth = $boxWidth * $maxHeight / $boxHeight;
628 $roundedUp = ceil( $idealWidth );
629 if ( round( $roundedUp * $boxHeight / $boxWidth ) > $maxHeight ) {
630 return floor( $idealWidth );
631 } else {
632 return $roundedUp;
633 }
634 }
635
636 /**
637 * Shown in file history box on image description page.
638 *
639 * @param File $file
640 * @return string Dimensions
641 */
642 function getDimensionsString( $file ) {
643 return '';
644 }
645
646 /**
647 * Modify the parser object post-transform.
648 *
649 * This is often used to do $parser->addOutputHook(),
650 * in order to add some javascript to render a viewer.
651 * See TimedMediaHandler or OggHandler for an example.
652 *
653 * @param Parser $parser
654 * @param File $file
655 */
656 function parserTransformHook( $parser, $file ) {
657 }
658
659 /**
660 * File validation hook called on upload.
661 *
662 * If the file at the given local path is not valid, or its MIME type does not
663 * match the handler class, a Status object should be returned containing
664 * relevant errors.
665 *
666 * @param string $fileName The local path to the file.
667 * @return Status object
668 */
669 function verifyUpload( $fileName ) {
670 return Status::newGood();
671 }
672
673 /**
674 * Check for zero-sized thumbnails. These can be generated when
675 * no disk space is available or some other error occurs
676 *
677 * @param string $dstPath The location of the suspect file
678 * @param int $retval Return value of some shell process, file will be deleted if this is non-zero
679 * @return bool True if removed, false otherwise
680 */
681 function removeBadFile( $dstPath, $retval = 0 ) {
682 if ( file_exists( $dstPath ) ) {
683 $thumbstat = stat( $dstPath );
684 if ( $thumbstat['size'] == 0 || $retval != 0 ) {
685 $result = unlink( $dstPath );
686
687 if ( $result ) {
688 wfDebugLog( 'thumbnail',
689 sprintf( 'Removing bad %d-byte thumbnail "%s". unlink() succeeded',
690 $thumbstat['size'], $dstPath ) );
691 } else {
692 wfDebugLog( 'thumbnail',
693 sprintf( 'Removing bad %d-byte thumbnail "%s". unlink() failed',
694 $thumbstat['size'], $dstPath ) );
695 }
696
697 return true;
698 }
699 }
700
701 return false;
702 }
703
704 /**
705 * Remove files from the purge list.
706 *
707 * This is used by some video handlers to prevent ?action=purge
708 * from removing a transcoded video, which is expensive to
709 * regenerate.
710 *
711 * @see LocalFile::purgeThumbnails
712 *
713 * @param array $files
714 * @param array $options Purge options. Currently will always be
715 * an array with a single key 'forThumbRefresh' set to true.
716 */
717 public function filterThumbnailPurgeList( &$files, $options ) {
718 // Do nothing
719 }
720
721 /*
722 * True if the handler can rotate the media
723 * @since 1.21
724 * @return bool
725 */
726 public static function canRotate() {
727 return false;
728 }
729
730 /**
731 * On supporting image formats, try to read out the low-level orientation
732 * of the file and return the angle that the file needs to be rotated to
733 * be viewed.
734 *
735 * This information is only useful when manipulating the original file;
736 * the width and height we normally work with is logical, and will match
737 * any produced output views.
738 *
739 * For files we don't know, we return 0.
740 *
741 * @param File $file
742 * @return int 0, 90, 180 or 270
743 */
744 public function getRotation( $file ) {
745 return 0;
746 }
747
748 /**
749 * Log an error that occurred in an external process
750 *
751 * Moved from BitmapHandler to MediaHandler with MediaWiki 1.23
752 *
753 * @since 1.23
754 * @param int $retval
755 * @param string $err Error reported by command. Anything longer than
756 * MediaHandler::MAX_ERR_LOG_SIZE is stripped off.
757 * @param string $cmd
758 */
759 protected function logErrorForExternalProcess( $retval, $err, $cmd ) {
760 # Keep error output limited (bug 57985)
761 $errMessage = trim( substr( $err, 0, self::MAX_ERR_LOG_SIZE ) );
762
763 wfDebugLog( 'thumbnail',
764 sprintf( 'thumbnail failed on %s: error %d "%s" from "%s"',
765 wfHostname(), $retval, $errMessage, $cmd ) );
766 }
767
768 /**
769 * Get list of languages file can be viewed in.
770 *
771 * @param File $file
772 * @return string[] Array of language codes, or empty array if unsupported.
773 * @since 1.23
774 */
775 public function getAvailableLanguages( File $file ) {
776 return array();
777 }
778
779 /**
780 * On file types that support renderings in multiple languages,
781 * which language is used by default if unspecified.
782 *
783 * If getAvailableLanguages returns a non-empty array, this must return
784 * a valid language code. Otherwise can return null if files of this
785 * type do not support alternative language renderings.
786 *
787 * @param File $file
788 * @return string|null Language code or null if multi-language not supported for filetype.
789 * @since 1.23
790 */
791 public function getDefaultRenderLanguage( File $file ) {
792 return null;
793 }
794
795 /**
796 * If its an audio file, return the length of the file. Otherwise 0.
797 *
798 * File::getLength() existed for a long time, but was calling a method
799 * that only existed in some subclasses of this class (The TMH ones).
800 *
801 * @param File $file
802 * @return float Length in seconds
803 * @since 1.23
804 */
805 public function getLength( $file ) {
806 return 0.0;
807 }
808
809 /**
810 * True if creating thumbnails from the file is large or otherwise resource-intensive.
811 * @param File $file
812 * @return bool
813 */
814 public function isExpensiveToThumbnail( $file ) {
815 return false;
816 }
817
818 /**
819 * Returns whether or not this handler supports the chained generation of thumbnails according
820 * to buckets
821 * @return boolean
822 * @since 1.24
823 */
824 public function supportsBucketing() {
825 return false;
826 }
827
828 /**
829 * Returns a normalised params array for which parameters have been cleaned up for bucketing
830 * purposes
831 * @param array $params
832 * @return array
833 */
834 public function sanitizeParamsForBucketing( $params ) {
835 return $params;
836 }
837 }