1a5c08a2da48d4c83d6ef44447e93a853186b294
4 * Backwards compatibility class
7 class Image
extends LocalFile
{
8 function __construct( $title ) {
9 wfDeprecated( __METHOD__
);
10 $repo = RepoGroup
::singleton()->getLocalRepo();
11 parent
::__construct( $title, $repo );
15 * Wrapper for wfFindFile(), for backwards-compatibility only
16 * Do not use in core code.
19 static function newFromTitle( $title, $time = false ) {
20 wfDeprecated( __METHOD__
);
21 $img = wfFindFile( $title, $time );
23 $img = wfLocalFile( $title );
29 * Wrapper for wfFindFile(), for backwards-compatibility only.
30 * Do not use in core code.
32 * @param string $name name of the image, used to create a title object using Title::makeTitleSafe
33 * @return image object or null if invalid title
36 static function newFromName( $name ) {
37 wfDeprecated( __METHOD__
);
38 $title = Title
::makeTitleSafe( NS_IMAGE
, $name );
39 if ( is_object( $title ) ) {
40 $img = wfFindFile( $title );
42 $img = wfLocalFile( $title );
51 * Return the URL of an image, provided its name.
53 * Backwards-compatibility for extensions.
54 * Note that fromSharedDirectory will only use the shared path for files
55 * that actually exist there now, and will return local paths otherwise.
57 * @param string $name Name of the image, without the leading "Image:"
58 * @param boolean $fromSharedDirectory Should this be in $wgSharedUploadPath?
59 * @return string URL of $name image
62 static function imageUrl( $name, $fromSharedDirectory = false ) {
63 wfDeprecated( __METHOD__
);
65 if( $fromSharedDirectory ) {
66 $image = wfFindFile( $name );
69 $image = wfLocalFile( $name );
71 return $image->getUrl();