Issue:Class 'Image' not found

From FollowTheScore
Jump to: navigation, search
Description: PHP Fatal error: Class 'Image' not found
Extension / Version: DPL   /   2.0
Type / Status: Bug   /   open

Problem

In MediaWiki 1.18.1:

PHP Fatal error: Class 'Image' not found in
/path/w/extensions/DynamicPageList/DPL.php on line 300

The line is:

// calculate URL for existing images                               
$img = Image::newFromName($article->mTitle->getText());

Patch

Class Image in includes/filerepo/Image.php was removed in 1.18. Here is a patch:

svn diff -r18555 DPL.php 
Index: DPL.php
===================================================================
--- DPL.php     (revision 18555)
+++ DPL.php     (working copy)
@@ -297,7 +297,7 @@
                        $imageUrl='';
                        if ($article->mNamespace==6) {
                                // calculate URL for existing images
-                               $img = Image::newFromName($article->mTitle->getText());
+                               $img = wfFindFile($article->mTitle);
                                if ($img && $img->exists()) {
                                        $imageUrl = $img->getURL();
                                        $imageUrl= preg_replace('~^.*images/(.*)~','\1',$imageUrl);

Reply