*/
$wgOriginTrials = [];
+/**
+ * Enable client-side Priority Hints.
+ *
+ * @warning EXPERIMENTAL!
+ *
+ * @since 1.34
+ * @var bool
+ */
+$wgPriorityHints = false;
+
/**
* For really cool vim folding this needs to be at the end:
* vim: foldmarker=@{,@} foldmethod=marker
* @ingroup Media
*/
class ThumbnailImage extends MediaTransformOutput {
+ private static $firstNonIconImageRendered = false;
+
/**
* Get a thumbnail object from a file and parameters.
* If $path is set to null, the output file is treated as a source copy.
* @return string
*/
function toHtml( $options = [] ) {
+ global $wgPriorityHints;
+
if ( count( func_get_args() ) == 2 ) {
throw new MWException( __METHOD__ . ' called in the old style' );
}
'decoding' => 'async',
];
+ if ( $wgPriorityHints
+ && !self::$firstNonIconImageRendered
+ && $this->width * $this->height > 100 * 100 ) {
+ self::$firstBigImageRendered = true;
+
+ $attribs['importance'] = 'high';
+ }
+
if ( !empty( $options['custom-url-link'] ) ) {
$linkAttribs = [ 'href' => $options['custom-url-link'] ];
if ( !empty( $options['title'] ) ) {