Difference between revisions of "Issue:Class 'Image' not found"

From FollowTheScore
Jump to: navigation, search
(Created page with "{{Issue |Type = Bug |Extension = DPL |Version = 2.0 |Description = PHP Fatal error: Class 'Image' not found |Status = open }} == Problem == In MediaWiki 1...")
 
(patch)
 
Line 22: Line 22:
 
</pre>
 
</pre>
  
 +
== Patch ==
 +
 +
Class Image in includes/filerepo/Image.php was removed in 1.18. Here is a patch:
 +
 +
<pre>
 +
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);
 +
</pre>
  
 
== Reply ==
 
== Reply ==

Latest revision as of 16:00, 6 February 2012

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