$scriptUrl = $thumbScript . '?f=' . urlencode( $this->name ) . '&w=' . urlencode( $width );
if ( $useScript ) {
// Use thumb.php to render the image
- return new ThumbnailImage( , $width, $height );
+ return new ThumbnailImage( $scriptUrl, $width, $height );
}
}
if ( $width != $this->img->getWidth() || $height != $this->img->getHeight() ) {
if( $wgUseImageResize ) {
$thumbnail = $this->img->getThumbnail( $width );
-
- if ( ( ! $this->img->mustRender() )
- && ( $thumbnail->getSize() > $this->img->getSize() ) ) {
- # the thumbnail is bigger thatn the original image.
- # show the original image instead of the thumb.
- $url = $full_url;
- $width = $this->img->getWidth();
- $height = $this->img->getHeight();
- } else {
- $url = $thumbnail->getUrl();
- }
+ $url = $thumbnail->getUrl();
} else {
# No resize ability? Show the full image, but scale
# it down in the browser so it fits on the page.
return;
}
+ header( "Cache-Control: s-maxage=$wgSquidMaxage, must-revalidate, max-age=0" );
+ header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s', $stat['mtime'] ) . ' GMT' );
+
+ if ( !empty( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) ) {
+ $sinceTime = strtotime( $_SERVER['HTTP_IF_MODIFIED_SINCE'] );
+ if ( $stat['mtime'] <= $sinceTime ) {
+ header( "HTTP/1.0 304 Not Modified" );
+ return;
+ }
+ }
$type = wfGetType( $fname );
if ( $type ) {
} else {
header('Content-type: application/x-wiki');
}
- header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s', $stat['mtime'] ) );
- header( "Cache-Control: s-maxage=$wgSquidMaxage, must-revalidate, max-age=0" );
readfile( $fname );
- exit;
}
function wfGetType( $filename ) {
// Some basic input validation
$width = intval( $width );
-$fileName = str_replace( '/', '_', $fileName );
+$fileName = strtr( $fileName, '\\/', '__' );
// Work out paths, carefully avoiding constructing an Image object because that won't work yet