7 * Class to represent an image
9 * Provides methods to retrieve paths (physical, logical, URL),
10 * to generate thumbnails or for uploading.
18 var $name, # name of the image
19 $imagePath, # Path of the image
21 $title, # Title object for this image. Initialized when needed.
22 $fileExists, # does the image file exist on disk?
23 $fromSharedDirectory, # load this image from $wgSharedUploadDirectory
24 $historyLine, # Number of line to return by nextHistoryLine()
25 $historyRes, # result of the query for the image's history
28 $bits, # --- returned by getimagesize, see http://de3.php.net/manual/en/function.getimagesize.php
36 * Create an Image object from an image name
38 * @param string $name name of the image, used to create a title object using Title::makeTitleSafe
41 function Image( $name ) {
43 global $wgUseSharedUploads, $wgUseLatin1, $wgSharedLatin1, $wgLang;
46 $this->title
= Title
::makeTitleSafe( NS_IMAGE
, $this->name
);
47 $this->fromSharedDirectory
= false;
48 $this->imagePath
= $this->getFullPath();
49 $this->fileExists
= file_exists( $this->imagePath
);
51 # If the file is not found, and a shared upload directory
52 # like the Wikimedia Commons is used, look for it there.
53 if (!$this->fileExists
&& $wgUseSharedUploads) {
55 # In case we're on a wgCapitalLinks=false wiki, we
56 # capitalize the first letter of the filename before
57 # looking it up in the shared repository.
58 $this->name
= $wgLang->ucfirst($name);
60 # Encode the filename if we're on a Latin1 wiki and the
61 # shared repository is UTF-8
62 if($wgUseLatin1 && !$wgSharedLatin1) {
63 $this->name
= utf8_encode($name);
66 $this->imagePath
= $this->getFullPath(true);
67 $this->fileExists
= file_exists( $this->imagePath
);
68 $this->fromSharedDirectory
= true;
72 if($this->fileExists
) {
73 $this->url
= $this->wfImageUrl( $this->name
, $this->fromSharedDirectory
);
78 $n = strrpos( $name, '.' );
79 $this->extension
= strtolower( $n ?
substr( $name, $n +
1 ) : '' );
82 if ( $this->fileExists
) {
83 if( $this->extension
== 'svg' ) {
84 @$gis = getSVGsize( $this->imagePath
);
86 @$gis = getimagesize( $this->imagePath
);
88 if( $gis !== false ) {
89 $this->width
= $gis[0];
90 $this->height
= $gis[1];
91 $this->type
= $gis[2];
92 $this->attr
= $gis[3];
93 if ( isset( $gis['bits'] ) ) {
94 $this->bits
= $gis['bits'];
100 $this->historyLine
= 0;
106 * Create a new image object from a title object.
108 * @param Title $nt Title object. Must be from namespace "image"
111 function newFromTitle( $nt ) {
112 $img = new Image( $nt->getDBKey() );
118 * Return the name of this image
126 * Return the associated title object
129 function getTitle() {
134 * Return the URL of the image file
141 function getViewURL() {
142 if( $this->mustRender() ) {
143 return $this->createThumb( $this->getWidth() );
145 return $this->getURL();
150 * Return the image path of the image in the
151 * local file system as an absolute path
154 function getImagePath()
156 return $this->imagePath
;
160 * Return the width of the image
162 * Returns -1 if the file specified is not a known image type
165 function getWidth() {
170 * Return the height of the image
172 * Returns -1 if the file specified is not a known image type
175 function getHeight() {
176 return $this->height
;
180 * Return the size of the image file, in bytes
184 $st = stat( $this->getImagePath() );
193 * Return the type of the image
206 * Return the escapeLocalURL of this image
209 function getEscapeLocalURL() {
210 return $this->title
->escapeLocalURL();
214 * Return the escapeFullURL of this image
217 function getEscapeFullURL() {
218 return $this->title
->escapeFullURL();
222 * Return the URL of an image, provided its name.
224 * @param string $name Name of the image, without the leading "Image:"
225 * @param boolean $fromSharedDirectory Should this be in $wgSharedUploadPath?
228 function wfImageUrl( $name, $fromSharedDirectory = false ) {
229 global $wgUploadPath,$wgUploadBaseUrl,$wgSharedUploadPath;
230 if($fromSharedDirectory) {
232 $path = $wgSharedUploadPath;
234 $base = $wgUploadBaseUrl;
235 $path = $wgUploadPath;
237 $url = "{$base}{$path}" . wfGetHashPath($name, $fromSharedDirectory) . "{$name}";
238 return wfUrlencode( $url );
242 * Returns true iff the image file exists on disk.
247 return $this->fileExists
;
254 function thumbUrl( $width, $subdir='thumb') {
255 global $wgUploadPath, $wgUploadBaseUrl,
256 $wgSharedUploadPath,$wgSharedUploadDirectory,
257 $wgUseLatin1,$wgSharedLatin1;
258 $name = $this->thumbName( $width );
259 if($this->fromSharedDirectory
) {
261 $path = $wgSharedUploadPath;
262 if($wgUseLatin1 && !$wgSharedLatin1) {
263 $name=utf8_encode($name);
266 $base = $wgUploadBaseUrl;
267 $path = $wgUploadPath;
269 $url = "{$base}{$path}/{$subdir}" .
270 wfGetHashPath($name, $this->fromSharedDirectory
)
272 return wfUrlencode($url);
276 * Return the file name of a thumbnail of the specified width
278 * @param integer $width Width of the thumbnail image
279 * @param boolean $shared Does the thumbnail come from the shared repository?
282 function thumbName( $width, $shared=false ) {
283 global $wgUseLatin1,$wgSharedLatin1;
284 $thumb = $width."px-".$this->name
;
285 if( $this->extension
== 'svg' ) {
286 # Rasterize SVG vector images to PNG
289 if( $shared && $wgUseLatin1 && !$wgSharedLatin1) {
290 $thumb=utf8_encode($thumb);
296 * Create a thumbnail of the image having the specified width/height.
297 * The thumbnail will not be created if the width is larger than the
298 * image's width. Let the browser do the scaling in this case.
299 * The thumbnail is stored on disk and is only computed if the thumbnail
300 * file does not exist OR if it is older than the image.
303 * Keeps aspect ratio of original image. If both width and height are
304 * specified, the generated image will be no bigger than width x height,
305 * and will also have correct aspect ratio.
307 * @param integer $width maximum width of the generated thumbnail
308 * @param integer $height maximum height of the image (optional)
311 function createThumb( $width, $height=-1 ) {
312 $thumb = $this->getThumbnail( $width, $height );
313 if( is_null( $thumb ) ) return '';
314 return $thumb->getUrl();
318 * As createThumb, but returns a ThumbnailImage object. This can
319 * provide access to the actual file, the real size of the thumb,
320 * and can produce a convenient <img> tag for you.
322 * @param integer $width maximum width of the generated thumbnail
323 * @param integer $height maximum height of the image (optional)
324 * @return ThumbnailImage
327 function &getThumbnail( $width, $height=-1 ) {
328 if ( $height == -1 ) {
329 return $this->renderThumb( $width );
331 if ( $width < $this->width
) {
332 $thumbheight = $this->height
* $width / $this->width
;
333 $thumbwidth = $width;
335 $thumbheight = $this->height
;
336 $thumbwidth = $this->width
;
338 if ( $thumbheight > $height ) {
339 $thumbwidth = $thumbwidth * $height / $thumbheight;
340 $thumbheight = $height;
342 $thumb = $this->renderThumb( $thumbwidth );
343 if( is_null( $thumb ) ) {
344 $thumb = $this->iconThumb();
350 * @return ThumbnailImage
352 function iconThumb() {
353 global $wgStylePath, $wgStyleDirectory;
355 $try = array( 'fileicon-' . $this->extension
. '.png', 'fileicon.png' );
356 foreach( $try as $icon ) {
357 $path = '/common/images/' . $icon;
358 $filepath = $wgStyleDirectory . $path;
359 if( file_exists( $filepath ) ) {
360 return new ThumbnailImage( $filepath, $wgStylePath . $path );
367 * Create a thumbnail of the image having the specified width.
368 * The thumbnail will not be created if the width is larger than the
369 * image's width. Let the browser do the scaling in this case.
370 * The thumbnail is stored on disk and is only computed if the thumbnail
371 * file does not exist OR if it is older than the image.
372 * Returns an object which can return the pathname, URL, and physical
373 * pixel size of the thumbnail -- or null on failure.
375 * @return ThumbnailImage
378 function /* private */ renderThumb( $width ) {
379 global $wgImageMagickConvertCommand;
380 global $wgUseImageMagick;
381 global $wgUseSquid, $wgInternalServer;
383 $width = IntVal( $width );
385 $thumbName = $this->thumbName( $width, $this->fromSharedDirectory
);
386 $thumbPath = wfImageThumbDir( $thumbName, 'thumb', $this->fromSharedDirectory
).'/'.$thumbName;
387 $thumbUrl = $this->thumbUrl( $width );
388 #wfDebug ( "Render name: $thumbName path: $thumbPath url: $thumbUrl\n");
389 if ( ! $this->exists() )
391 # If there is no image, there will be no thumbnail
395 # Sanity check $width
401 if( $width > $this->width
&& !$this->mustRender() ) {
402 # Don't make an image bigger than the source
403 return new ThumbnailImage( $this->getImagePath(), $this->getViewURL() );
406 if ( (! file_exists( $thumbPath ) ) ||
( filemtime($thumbPath) < filemtime($this->imagePath
) ) ) {
407 if( $this->extension
== 'svg' ) {
408 global $wgSVGConverters, $wgSVGConverter;
409 if( isset( $wgSVGConverters[$wgSVGConverter] ) ) {
410 global $wgSVGConverterPath;
412 array( '$path/', '$width', '$input', '$output' ),
413 array( $wgSVGConverterPath,
415 escapeshellarg( $this->imagePath
),
416 escapeshellarg( $thumbPath ) ),
417 $wgSVGConverters[$wgSVGConverter] );
418 $conv = shell_exec( $cmd );
422 } elseif ( $wgUseImageMagick ) {
424 # Specify white background color, will be used for transparent images
425 # in Internet Explorer/Windows instead of default black.
426 $cmd = $wgImageMagickConvertCommand .
427 " -quality 85 -background white -geometry {$width} ".
428 escapeshellarg($this->imagePath
) . " " .
429 escapeshellarg($thumbPath);
430 $conv = shell_exec( $cmd );
432 # Use PHP's builtin GD library functions.
434 # First find out what kind of file this is, and select the correct
435 # input routine for this.
439 switch( $this->type
) {
441 $src_image = imagecreatefromgif( $this->imagePath
);
444 $src_image = imagecreatefromjpeg( $this->imagePath
);
448 $src_image = imagecreatefrompng( $this->imagePath
);
449 $truecolor = ( $this->bits
> 8 );
451 case 15: # WBMP for WML
452 $src_image = imagecreatefromwbmp( $this->imagePath
);
455 $src_image = imagecreatefromxbm( $this->imagePath
);
458 return 'Image type not supported';
461 $height = floor( $this->height
* ( $width/$this->width
) );
463 $dst_image = imagecreatetruecolor( $width, $height );
465 $dst_image = imagecreate( $width, $height );
467 imagecopyresampled( $dst_image, $src_image,
469 $width, $height, $this->width
, $this->height
);
470 switch( $this->type
) {
475 #$thumbUrl .= ".png";
476 #$thumbPath .= ".png";
477 imagepng( $dst_image, $thumbPath );
480 #$thumbUrl .= ".jpg";
481 #$thumbPath .= ".jpg";
482 imageinterlace( $dst_image );
483 imagejpeg( $dst_image, $thumbPath, 95 );
488 imagedestroy( $dst_image );
489 imagedestroy( $src_image );
492 # Check for zero-sized thumbnails. Those can be generated when
493 # no disk space is available or some other error occurs
495 if( file_exists( $thumbPath ) ) {
496 $thumbstat = stat( $thumbPath );
497 if( $thumbstat['size'] == 0 ) {
498 unlink( $thumbPath );
503 # This has to be done after the image is updated and present for all machines on NFS,
504 # or else the old version might be stored into the squid again
507 $wgInternalServer.$thumbUrl
509 wfPurgeSquidServers($urlArr);
512 return new ThumbnailImage( $thumbPath, $thumbUrl );
513 } // END OF function createThumb
516 * Return the image history of this image, line by line.
517 * starts with current version, then old versions.
518 * uses $this->historyLine to check which line to return:
519 * 0 return line for current version
520 * 1 query for old versions, return first one
521 * 2, ... return next old version from above query
525 function nextHistoryLine() {
526 $fname = 'Image::nextHistoryLine()';
527 $dbr =& wfGetDB( DB_SLAVE
);
528 if ( $this->historyLine
== 0 ) {// called for the first time, return line from cur
529 $this->historyRes
= $dbr->select( 'image',
530 array( 'img_size','img_description','img_user','img_user_text','img_timestamp', "'' AS oi_archive_name" ),
531 array( 'img_name' => $this->title
->getDBkey() ),
534 if ( 0 == wfNumRows( $this->historyRes
) ) {
537 } else if ( $this->historyLine
== 1 ) {
538 $this->historyRes
= $dbr->select( 'oldimage',
539 array( 'oi_size AS img_size', 'oi_description AS img_description', 'oi_user AS img_user',
540 'oi_user_text AS img_user_text', 'oi_timestamp AS img_timestamp', 'oi_archive_name'
541 ), array( 'oi_name' => $this->title
->getDBkey() ), $fname, array( 'ORDER BY' => 'oi_timestamp DESC' )
544 $this->historyLine ++
;
546 return $dbr->fetchObject( $this->historyRes
);
550 * Reset the history pointer to the first element of the history
553 function resetHistory() {
554 $this->historyLine
= 0;
558 * Return true if the file is of a type that can't be directly
559 * rendered by typical browsers and needs to be re-rasterized.
562 function mustRender() {
563 return ( $this->extension
== 'svg' );
567 * Return the full filesystem path to the file. Note that this does
568 * not mean that a file actually exists under that location.
570 * This path depends on whether directory hashing is active or not,
571 * i.e. whether the images are all found in the same directory,
572 * or in hashed paths like /images/3/3c.
575 * @param boolean $fromSharedDirectory Return the path to the file
576 * in a shared repository (see $wgUseSharedRepository and related
577 * options in DefaultSettings.php) instead of a local one.
580 function getFullPath( $fromSharedRepository = false ) {
581 global $wgUploadDirectory, $wgSharedUploadDirectory;
582 global $wgHashedUploadDirectory, $wgHashedSharedUploadDirectory;
584 $dir = $fromSharedRepository ?
$wgSharedUploadDirectory :
586 $ishashed = $fromSharedRepository ?
$wgHashedSharedUploadDirectory :
587 $wgHashedUploadDirectory;
589 $fullpath = $dir . wfGetHashPath($name) . $name;
597 * Returns the image directory of an image
598 * If the directory does not exist, it is created.
599 * The result is an absolute path.
601 * @param string $fname file name of the image file
604 function wfImageDir( $fname ) {
605 global $wgUploadDirectory, $wgHashedUploadDirectory;
607 if (!$wgHashedUploadDirectory) { return $wgUploadDirectory; }
609 $hash = md5( $fname );
610 $oldumask = umask(0);
611 $dest = $wgUploadDirectory . '/' . $hash{0};
612 if ( ! is_dir( $dest ) ) { mkdir( $dest, 0777 ); }
613 $dest .= '/' . substr( $hash, 0, 2 );
614 if ( ! is_dir( $dest ) ) { mkdir( $dest, 0777 ); }
621 * Returns the image directory of an image's thubnail
622 * If the directory does not exist, it is created.
623 * The result is an absolute path.
625 * @param string $fname file name of the thumbnail file, including file size prefix
626 * @param string $subdir (optional) subdirectory of the image upload directory that should be used for storing the thumbnail. Default is 'thumb'
627 * @param boolean $shared (optional) use the shared upload directory
630 function wfImageThumbDir( $fname , $subdir='thumb', $shared=false) {
631 return wfImageArchiveDir( $fname, $subdir, $shared );
635 * Returns the image directory of an image's old version
636 * If the directory does not exist, it is created.
637 * The result is an absolute path.
639 * @param string $fname file name of the thumbnail file, including file size prefix
640 * @param string $subdir (optional) subdirectory of the image upload directory that should be used for storing the old version. Default is 'archive'
641 * @param boolean $shared (optional) use the shared upload directory (only relevant for other functions which call this one)
644 function wfImageArchiveDir( $fname , $subdir='archive', $shared=false ) {
645 global $wgUploadDirectory, $wgHashedUploadDirectory,
646 $wgSharedUploadDirectory, $wgHashedSharedUploadDirectory;
647 $dir = $shared ?
$wgSharedUploadDirectory : $wgUploadDirectory;
648 $hashdir = $shared ?
$wgHashedSharedUploadDirectory : $wgHashedUploadDirectory;
649 if (!$hashdir) { return $dir.'/'.$subdir; }
650 $hash = md5( $fname );
651 $oldumask = umask(0);
652 # Suppress warning messages here; if the file itself can't
653 # be written we'll worry about it then.
654 $archive = $dir.'/'.$subdir;
655 if ( ! is_dir( $archive ) ) { @mkdir
( $archive, 0777 ); }
656 $archive .= '/' . $hash{0};
657 if ( ! is_dir( $archive ) ) { @mkdir
( $archive, 0777 ); }
658 $archive .= '/' . substr( $hash, 0, 2 );
659 if ( ! is_dir( $archive ) ) { @mkdir
( $archive, 0777 ); }
667 * Return the hash path component of an image path (URL or filesystem),
668 * e.g. "/3/3c/", or just "/" if hashing is not used.
670 * @param $dbkey The filesystem / database name of the file
671 * @param $fromSharedDirectory Use the shared file repository? It may
672 * use different hash settings from the local one.
674 function wfGetHashPath ( $dbkey, $fromSharedDirectory = false ) {
675 global $wgHashedSharedUploadDirectory, $wgSharedUploadDirectory;
677 $ishashed = $fromSharedDirectory ?
$wgHashedSharedUploadDirectory :
678 $wgSharedUploadDirectory;
681 return '/' . $hash{0} . '/' . substr( $hash, 0, 2 ) . '/';
689 * Record an image upload in the upload log.
691 function wfRecordUpload( $name, $oldver, $size, $desc, $copyStatus = '', $source = '' ) {
692 global $wgUser, $wgLang, $wgTitle, $wgOut, $wgDeferredUpdateList;
693 global $wgUseCopyrightUpload;
695 $fname = 'wfRecordUpload';
696 $dbw =& wfGetDB( DB_MASTER
);
698 # img_name must be unique
699 if ( !$dbw->indexUnique( 'image', 'img_name' ) && !$dbw->indexExists('image','PRIMARY') ) {
700 wfDebugDieBacktrace( 'Database schema not up to date, please run maintenance/archives/patch-image_name_unique.sql' );
704 $now = wfTimestampNow();
705 $won = wfInvertTimestamp( $now );
706 $size = IntVal( $size );
708 if ( $wgUseCopyrightUpload ) {
709 $textdesc = '== ' . wfMsg ( 'filedesc' ) . " ==\n" . $desc . "\n" .
710 '== ' . wfMsg ( 'filestatus' ) . " ==\n" . $copyStatus . "\n" .
711 '== ' . wfMsg ( 'filesource' ) . " ==\n" . $source ;
713 else $textdesc = $desc ;
715 $now = wfTimestampNow();
716 $won = wfInvertTimestamp( $now );
718 # Test to see if the row exists using INSERT IGNORE
719 # This avoids race conditions by locking the row until the commit, and also
720 # doesn't deadlock. SELECT FOR UPDATE causes a deadlock for every race condition.
721 $dbw->insert( 'image',
725 'img_timestamp' => $dbw->timestamp($now),
726 'img_description' => $desc,
727 'img_user' => $wgUser->getID(),
728 'img_user_text' => $wgUser->getName(),
731 $descTitle = Title
::makeTitleSafe( NS_IMAGE
, $name );
733 if ( $dbw->affectedRows() ) {
734 # Successfully inserted, this is a new image
735 $id = $descTitle->getArticleID();
738 $article = new Article( $descTitle );
739 $article->insertNewArticle( $textdesc, $desc, false, false );
742 # Collision, this is an update of an image
743 # Get current image row for update
744 $s = $dbw->selectRow( 'image', array( 'img_name','img_size','img_timestamp','img_description',
745 'img_user','img_user_text' ), array( 'img_name' => $name ), $fname, 'FOR UPDATE' );
747 # Insert it into oldimage
748 $dbw->insert( 'oldimage',
750 'oi_name' => $s->img_name
,
751 'oi_archive_name' => $oldver,
752 'oi_size' => $s->img_size
,
753 'oi_timestamp' => $dbw->timestamp($s->img_timestamp
),
754 'oi_description' => $s->img_description
,
755 'oi_user' => $s->img_user
,
756 'oi_user_text' => $s->img_user_text
760 # Update the current image row
761 $dbw->update( 'image',
764 'img_timestamp' => $dbw->timestamp(),
765 'img_user' => $wgUser->getID(),
766 'img_user_text' => $wgUser->getName(),
767 'img_description' => $desc,
768 ), array( /* WHERE */
773 # Invalidate the cache for the description page
774 $descTitle->invalidateCache();
777 $log = new LogPage( 'upload' );
778 $log->addEntry( 'upload', $descTitle, $desc );
782 * Returns the image URL of an image's old version
784 * @param string $fname file name of the image file
785 * @param string $subdir (optional) subdirectory of the image upload directory that is used by the old version. Default is 'archive'
788 function wfImageArchiveUrl( $name, $subdir='archive' ) {
789 global $wgUploadPath, $wgHashedUploadDirectory;
791 if ($wgHashedUploadDirectory) {
792 $hash = md5( substr( $name, 15) );
793 $url = $wgUploadPath.'/'.$subdir.'/' . $hash{0} . '/' .
794 substr( $hash, 0, 2 ) . '/'.$name;
796 $url = $wgUploadPath.'/'.$subdir.'/'.$name;
798 return wfUrlencode($url);
802 * Return a rounded pixel equivalent for a labeled CSS/SVG length.
803 * http://www.w3.org/TR/SVG11/coords.html#UnitIdentifiers
805 * @param string $length
806 * @return int Length in pixels
808 function scaleSVGUnit( $length ) {
809 static $unitLength = array(
816 '' => 1.0, // "User units" pixels by default
817 '%' => 2.0, // Fake it!
819 if( preg_match( '/^(\d+)(em|ex|px|pt|pc|cm|mm|in|%|)$/', $length, $matches ) ) {
820 $length = FloatVal( $matches[1] );
822 return round( $length * $unitLength[$unit] );
825 return round( FloatVal( $length ) );
830 * Compatible with PHP getimagesize()
831 * @todo support gzipped SVGZ
832 * @todo check XML more carefully
833 * @todo sensible defaults
835 * @param string $filename
838 function getSVGsize( $filename ) {
842 // Read a chunk of the file
843 $f = fopen( $filename, "rt" );
844 if( !$f ) return false;
845 $chunk = fread( $f, 4096 );
848 // Uber-crappy hack! Run through a real XML parser.
849 if( !preg_match( '/<svg\s*([^>]*)\s*>/s', $chunk, $matches ) ) {
853 if( preg_match( '/\bwidth\s*=\s*("[^"]+"|\'[^\']+\')/s', $tag, $matches ) ) {
854 $width = scaleSVGUnit( trim( substr( $matches[1], 1, -1 ) ) );
856 if( preg_match( '/\bheight\s*=\s*("[^"]+"|\'[^\']+\')/s', $tag, $matches ) ) {
857 $height = scaleSVGUnit( trim( substr( $matches[1], 1, -1 ) ) );
860 return array( $width, $height, 'SVG',
861 "width=\"$width\" height=\"$height\"" );
866 * Wrapper class for thumbnail images
869 class ThumbnailImage
{
871 * @param string $path Filesystem path to the thumb
872 * @param string $url URL path to the thumb
875 function ThumbnailImage( $path, $url ) {
878 $size = @getimagesize
( $this->path
);
880 $this->width
= $size[0];
881 $this->height
= $size[1];
889 * @return string The thumbnail URL
896 * Return HTML <img ... /> tag for the thumbnail, will include
897 * width and height attributes and a blank alt text (as required).
899 * You can set or override additional attributes by passing an
900 * associative array of name => data pairs. The data will be escaped
901 * for HTML output, so should be in plaintext.
903 * @param array $attribs
907 function toHtml( $attribs = array() ) {
908 $attribs['src'] = $this->url
;
909 $attribs['width'] = $this->width
;
910 $attribs['height'] = $this->height
;
911 if( !isset( $attribs['alt'] ) ) $attribs['alt'] = '';
914 foreach( $attribs as $name => $data ) {
915 $html .= $name . '="' . htmlspecialchars( $data ) . '" ';
922 * Return the size of the thumbnail file, in bytes or false if the file
927 $st = stat( $this->path
);