}
$conf->ImageMagick = false;
+$imcheck = array( "/usr/bin", "/usr/local/bin", "/sw/bin", "/opt/local/bin" );
+foreach( $imcheck as $dir ) {
+ $im = "$dir/convert";
+ if( file_exists( $im ) ) {
+ print "<li>Found ImageMagick: <tt>$im</tt>; image thumbnailing will be enabled if you enable uploads.</li>\n";
+ $conf->ImageMagick = $im;
+ break;
+ }
+}
$conf->HaveGD = function_exists( "imagejpeg" );
if( $conf->HaveGD ) {
- print "<li>Found GD graphics library built-in, image thumbnailing will be enabled if you enable uploads.</li>\n";
-} else {
- $imcheck = array( "/usr/bin", "/usr/local/bin", "/sw/bin" );
- foreach( $imcheck as $dir ) {
- $im = "$dir/convert";
- if( file_exists( $im ) ) {
- print "<li>Found ImageMagick: <tt>$im</tt>; image thumbnailing will be enabled if you enable uploads.</li>\n";
- $conf->ImageMagick = $im;
- break;
- }
+ print "<li>Found GD graphics library built-in";
+ if( !$conf->ImageMagick ) {
+ print ", image thumbnailing will be enabled if you enable uploads";
}
+ print ".</li>\n";
+} else {
if( !$conf->ImageMagick ) {
print "<li>Couldn't find GD library or ImageMagick; image thumbnailing disabled.</li>\n";
}
{
return $this->url;
}
+
+ function getViewURL() {
+ if( $this->mustRender() ) {
+ return $this->createThumb( $this->getWidth() );
+ } else {
+ return $this->getURL();
+ }
+ }
/**
* Return the image path of the image in the
if( $width > $this->width ) {
# Don't make an image bigger than the source
- return $this->getURL();
+ return $this->getViewURL();
}
if ( (! file_exists( $thumbPath ) ) || ( filemtime($thumbPath) < filemtime($this->imagePath) ) ) {
$this->historyLine = 0;
}
-
+ /**
+ * Return true if the file is of a type that can't be directly
+ * rendered by typical browsers and needs to be re-rasterized.
+ * @return bool
+ */
+ function mustRender() {
+ return ( $this->extension == 'svg' );
+ }
+
} //class
{
global $wgOut, $wgUser, $wgImageLimits, $wgRequest, $wgUseImageResize;
$this->img = Image::newFromTitle( $this->mTitle );
- $url = $this->img->getUrl();
+ $url = $this->img->getViewURL();
$anchoropen = '';
$anchorclose = '';
if ( $wgUseImageResize && $wgUser->getOption( 'imagesize' ) != '' ) {
function makeImageLinkObj( $nt, $alt = '' ) {
global $wgContLang, $wgUseImageResize;
$img = Image::newFromTitle( $nt );
- $url = $img->getURL();
+ $url = $img->getViewURL();
$align = '';
$prefix = $postfix = '';
function makeThumbLinkObj( $img, $label = '', $align = 'right', $boxwidth = 180, $boxheight=false, $framed=false , $manual_thumb = "" ) {
global $wgStylePath, $wgContLang;
# $image = Title::makeTitleSafe( NS_IMAGE, $name );
- $url = $img->getURL();
+ $url = $img->getViewURL();
#$label = htmlspecialchars( $label );
$alt = preg_replace( '/<[^>]*>/', '', $label);
{
$manual_title = Title::makeTitleSafe( NS_IMAGE, $manual_thumb ); #new Title ( $manual_thumb ) ;
$manual_img = Image::newFromTitle( $manual_title );
- $thumbUrl = $manual_img->getURL();
+ $thumbUrl = $manual_img->getViewURL();
if ( $manual_img->exists() )
{
$width = $manual_img->getWidth();