From 96f47a6c5b59f4f5577a8ba84bb2409c205b1b64 Mon Sep 17 00:00:00 2001 From: Jens Frank Date: Thu, 6 May 2004 06:31:35 +0000 Subject: [PATCH] Merged wfImagePath into Image class --- includes/Image.php | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/includes/Image.php b/includes/Image.php index c183d46735..9b01e7814a 100644 --- a/includes/Image.php +++ b/includes/Image.php @@ -20,11 +20,16 @@ class Image function Image( $name ) { + global $wgUploadDirectory; + $this->name = $name; $this->title = Title::makeTitle( Namespace::getImage(), $this->name ); - $this->imagePath = wfImagePath( $name ); + //$this->imagePath = wfImagePath( $name ); + $hash = md5( $this->title->getDBkey() ); + $this->imagePath = $wgUploadDirectory . "/" . $hash{0} . "/" .substr( $hash, 0, 2 ) . "/{$name}"; + $this->url = $this->wfImageUrl( $name ); - + if ( $this->fileExists = file_exists( $this->imagePath ) ) // Sic!, "=" is intended { list($this->width, $this->height, $this->type, $this->attr) = getimagesize( $this->imagePath ); @@ -216,19 +221,3 @@ class Image } //class -// return path name of an image -// canonicalize name. -function wfImagePath( $imgname ) -{ - global $wgUploadDirectory; - - $nt = Title::newFromText( $imgname ); - if( !$nt ) return ""; - - $name = $nt->getDBkey(); - $hash = md5( $name ); - - $path = "{$wgUploadDirectory}/" . $hash{0} . "/" . - substr( $hash, 0, 2 ) . "/{$name}"; - return $path; -} -- 2.20.1