* @param string $name name of the image, used to create a title object using Title::makeTitleSafe
* @access public
*/
- function Image( $name )
- {
+ function Image( $name ) {
global $wgUseSharedUploads, $wgUseLatin1, $wgSharedLatin1, $wgLang;
$this->extension = strtolower( $n ? substr( $name, $n + 1 ) : '' );
- if ( $this->fileExists )
- {
+ if ( $this->fileExists ) {
if( $this->extension == 'svg' ) {
@$gis = getSVGsize( $this->imagePath );
} else {
* @param Title $nt Title object. Must be from namespace "image"
* @access public
*/
- function newFromTitle( $nt )
- {
+ function newFromTitle( $nt ) {
$img = new Image( $nt->getDBKey() );
$img->title = $nt;
return $img;
* Return the name of this image
* @access public
*/
- function getName()
- {
+ function getName() {
return $this->name;
}
* Return the associated title object
* @access public
*/
- function getTitle()
- {
+ function getTitle() {
return $this->title;
}
* Return the URL of the image file
* @access public
*/
- function getURL()
- {
+ function getURL() {
return $this->url;
}
* Returns -1 if the file specified is not a known image type
* @access public
*/
- function getWidth()
- {
+ function getWidth() {
return $this->width;
}
* Returns -1 if the file specified is not a known image type
* @access public
*/
- function getHeight()
- {
+ function getHeight() {
return $this->height;
}
* Return the size of the image file, in bytes
* @access public
*/
- function getSize()
- {
+ function getSize() {
$st = stat( $this->getImagePath() );
if( $st ) {
return $st['size'];
* - 15 WBMP
* - 16 XBM
*/
- function getType()
- {
+ function getType() {
return $this->type;
}
* Return the escapeLocalURL of this image
* @access public
*/
- function getEscapeLocalURL()
- {
+ function getEscapeLocalURL() {
return $this->title->escapeLocalURL();
}
* Return the escapeFullURL of this image
* @access public
*/
- function getEscapeFullURL()
- {
+ function getEscapeFullURL() {
return $this->title->escapeFullURL();
}
* @param boolean $fromSharedDirectory Should this be in $wgSharedUploadPath?
* @access public
*/
- function wfImageUrl( $name, $fromSharedDirectory = false )
- {
+ function wfImageUrl( $name, $fromSharedDirectory = false ) {
global $wgUploadPath,$wgUploadBaseUrl,$wgSharedUploadPath;
if($fromSharedDirectory) {
$base = '';
*
* @access public
*/
- function exists()
- {
+ function exists() {
return $this->fileExists;
}
*
* @access public
*/
- function nextHistoryLine()
- {
+ function nextHistoryLine() {
$fname = 'Image::nextHistoryLine()';
$dbr =& wfGetDB( DB_SLAVE );
if ( $this->historyLine == 0 ) {// called for the first time, return line from cur
* Reset the history pointer to the first element of the history
* @access public
*/
- function resetHistory()
- {
+ function resetHistory() {
$this->historyLine = 0;
}
* options in DefaultSettings.php) instead of a local one.
*
*/
- function getFullPath( $fromSharedRepository = false )
- {
+ function getFullPath( $fromSharedRepository = false ) {
global $wgUploadDirectory, $wgSharedUploadDirectory;
global $wgHashedUploadDirectory, $wgHashedSharedUploadDirectory;
return $fullpath;
}
-
} //class
* @param string $fname file name of the image file
* @access public
*/
-function wfImageDir( $fname )
-{
+function wfImageDir( $fname ) {
global $wgUploadDirectory, $wgHashedUploadDirectory;
if (!$wgHashedUploadDirectory) { return $wgUploadDirectory; }
* @param boolean $shared (optional) use the shared upload directory
* @access public
*/
-function wfImageThumbDir( $fname , $subdir='thumb', $shared=false)
-{
+function wfImageThumbDir( $fname , $subdir='thumb', $shared=false) {
return wfImageArchiveDir( $fname, $subdir, $shared );
}
* @param boolean $shared (optional) use the shared upload directory (only relevant for other functions which call this one)
* @access public
*/
-function wfImageArchiveDir( $fname , $subdir='archive', $shared=false )
-{
+function wfImageArchiveDir( $fname , $subdir='archive', $shared=false ) {
global $wgUploadDirectory, $wgHashedUploadDirectory,
$wgSharedUploadDirectory, $wgHashedSharedUploadDirectory;
$dir = $shared ? $wgSharedUploadDirectory : $wgUploadDirectory;
$wgSharedUploadDirectory;
if($ishashed) {
$hash = md5($dbkey);
- return '/' . $hash{0} . '/' . substr( $hash, 0, 2 ) . "/";
+ return '/' . $hash{0} . '/' . substr( $hash, 0, 2 ) . '/';
} else {
return '/';
}
/**
* Record an image upload in the upload log.
*/
-function wfRecordUpload( $name, $oldver, $size, $desc, $copyStatus = "", $source = "" )
-{
+function wfRecordUpload( $name, $oldver, $size, $desc, $copyStatus = '', $source = '' ) {
global $wgUser, $wgLang, $wgTitle, $wgOut, $wgDeferredUpdateList;
global $wgUseCopyrightUpload;
$won = wfInvertTimestamp( $now );
$size = IntVal( $size );
- if ( $wgUseCopyrightUpload )
- {
+ if ( $wgUseCopyrightUpload ) {
$textdesc = '== ' . wfMsg ( 'filedesc' ) . " ==\n" . $desc . "\n" .
'== ' . wfMsg ( 'filestatus' ) . " ==\n" . $copyStatus . "\n" .
'== ' . wfMsg ( 'filesource' ) . " ==\n" . $source ;
- }
+ }
else $textdesc = $desc ;
$now = wfTimestampNow();
* @param string $subdir (optional) subdirectory of the image upload directory that is used by the old version. Default is 'archive'
* @access public
*/
-function wfImageArchiveUrl( $name, $subdir='archive' )
-{
+function wfImageArchiveUrl( $name, $subdir='archive' ) {
global $wgUploadPath, $wgHashedUploadDirectory;
if ($wgHashedUploadDirectory) {
$this->height = 0;
}
}
-
+
+ /**
+ * @return string The thumbnail URL
+ */
function getUrl() {
return $this->url;
}
return $html;
}
- /**
- * Return the size of the thumbnail file, in bytes
- * @access public
- */
- function getSize()
- {
- $st = stat( $this->path );
- if( $st ) {
- return $st['size'];
- } else {
- return false; }
- }
-
+ /**
+ * Return the size of the thumbnail file, in bytes or false if the file
+ * can't be stat().
+ * @access public
+ */
+ function getSize() {
+ $st = stat( $this->path );
+ if( $st ) {
+ return $st['size'];
+ } else {
+ return false;
+ }
+ }
}
-
-?>
+?>
\ No newline at end of file