X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=thumb.php;h=12173c55ddae9f31d28f05d08d52c9df2b89ee2c;hb=795c8958840771e3a8603c417af3f0c464cf3cbd;hp=c4e690e44cbeb3b56316352251ddb7f62600fab4;hpb=f8ab4e5ffee1cfb53da38d3dffcd37ffe4e2abbc;p=lhc%2Fweb%2Fwiklou.git diff --git a/thumb.php b/thumb.php index c4e690e44c..12173c55dd 100644 --- a/thumb.php +++ b/thumb.php @@ -213,6 +213,7 @@ function wfStreamThumb( array $params ) { if ( count( $varyHeader ) ) { $response->header( 'Vary: ' . implode( ', ', $varyHeader ) ); } + $response->header( 'Content-Length: 0' ); return; } @@ -301,9 +302,14 @@ function wfStreamThumb( array $params ) { // Stream the file if it exists already... $thumbPath = $img->getThumbPath( $thumbName ); if ( $img->getRepo()->fileExists( $thumbPath ) ) { + $starttime = microtime( true ); $success = $img->getRepo()->streamFile( $thumbPath, $headers ); + $streamtime = microtime( true ) - $starttime; + if ( !$success ) { wfThumbError( 500, 'Could not stream the file' ); + } else { + RequestContext::getMain()->getStats()->timing( 'media.thumbnail.stream', $streamtime ); } return; } @@ -317,8 +323,8 @@ function wfStreamThumb( array $params ) { return; } - // Actually generate a new thumbnail list( $thumb, $errorMsg ) = wfGenerateThumbnail( $img, $params, $thumbName, $thumbPath ); + /** @var MediaTransformOutput|bool $thumb */ // Check for thumbnail generation errors... @@ -570,7 +576,7 @@ function wfThumbError( $status, $msg ) { } else { $debug = ''; } - echo << @@ -586,4 +592,6 @@ $debug EOT; + header( 'Content-Length: ' . strlen( $content ) ); + echo $content; }