dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
specify colour for a:visited so users don't go blind
[lhc/web/wiklou.git]
/
thumb.php
diff --git
a/thumb.php
b/thumb.php
index
ff7f915
..
ff84d89
100644
(file)
--- a/
thumb.php
+++ b/
thumb.php
@@
-5,10
+5,16
@@
* If the file exists, we make do with abridged MediaWiki initialisation.
*/
* If the file exists, we make do with abridged MediaWiki initialisation.
*/
-unset( $IP );
define( 'MEDIAWIKI', true );
define( 'MEDIAWIKI', true );
+unset( $IP );
+$wgNoOutputBuffer = true;
+
require_once( './includes/Defines.php' );
require_once( './LocalSettings.php' );
require_once( './includes/Defines.php' );
require_once( './LocalSettings.php' );
+require_once( 'GlobalFunctions.php' );
+
+$wgTrivialMimeDetection = true; //don't use fancy mime detection, just check the file extension for jpg/gif/png.
+
require_once( 'Image.php' );
require_once( 'StreamFile.php' );
require_once( 'Image.php' );
require_once( 'StreamFile.php' );
@@
-22,6
+28,8
@@
if ( get_magic_quotes_gpc() ) {
$width = $_REQUEST['w'];
}
$width = $_REQUEST['w'];
}
+$pre_render= isset($_REQUEST['r']) && $_REQUEST['r']!="0";
+
// Some basic input validation
$width = intval( $width );
// Some basic input validation
$width = intval( $width );
@@
-31,10
+39,10
@@
$fileName = strtr( $fileName, '\\/', '__' );
$imagePath = wfImageDir( $fileName ) . '/' . $fileName;
$thumbName = "{$width}px-$fileName";
$imagePath = wfImageDir( $fileName ) . '/' . $fileName;
$thumbName = "{$width}px-$fileName";
-if (
preg_match( '/\.svg$/', $fileName )
) {
+if (
$pre_render
) {
$thumbName .= '.png';
}
$thumbName .= '.png';
}
-$thumbPath = wfImageThumbDir( $
thumb
Name ) . '/' . $thumbName;
+$thumbPath = wfImageThumbDir( $
file
Name ) . '/' . $thumbName;
if ( file_exists( $thumbPath ) && filemtime( $thumbPath ) >= filemtime( $imagePath ) ) {
wfStreamFile( $thumbPath );
if ( file_exists( $thumbPath ) && filemtime( $thumbPath ) >= filemtime( $imagePath ) ) {
wfStreamFile( $thumbPath );
@@
-44,18
+52,14
@@
if ( file_exists( $thumbPath ) && filemtime( $thumbPath ) >= filemtime( $imagePa
// OK, no valid thumbnail, time to get out the heavy machinery
require_once( 'Setup.php' );
// OK, no valid thumbnail, time to get out the heavy machinery
require_once( 'Setup.php' );
-// Force renderThumb() to actually do something
-$wgThumbnailScriptPath = false;
-$wgSharedThumbnailScriptPath = false;
-
$img = Image::newFromName( $fileName );
if ( $img ) {
$img = Image::newFromName( $fileName );
if ( $img ) {
- $thumb = $img->renderThumb( $width );
+ $thumb = $img->renderThumb( $width
, false
);
} else {
$thumb = false;
}
} else {
$thumb = false;
}
-if ( $thumb ) {
+if ( $thumb
&& $thumb->path
) {
wfStreamFile( $thumb->path );
} else {
$badtitle = wfMsg( 'badtitle' );
wfStreamFile( $thumb->path );
} else {
$badtitle = wfMsg( 'badtitle' );