コード例 #1
0
 /**
  * Get the thumbnail url to be displayed. 
  * If the thumbnail exists, and it is up-to-date
  * the thumbnail url will be returns. If the 
  * file is not an image, a default image will be returned.
  * If it is an image file, and no thumbnail exists or 
  * the thumbnail is out-of-date (i.e. the thumbnail 
  * modified time is less than the original file)
  * then a thumbs.php?img=filename.jpg is returned.
  * The thumbs.php url will generate a new thumbnail
  * on the fly. If the image is less than the dimensions
  * of the thumbnails, the image will be display instead.
  * @param string $relative the relative image file.
  * @return string the url of the thumbnail, be it
  * actually thumbnail or a script to generate the
  * thumbnail on the fly.
  */
 function getThumbnail($relative)
 {
     global $IMConfig;
     _ddt(__FILE__, __LINE__, "getThumbnail(): top with '{$relative}'");
     $fullpath = Files::makeFile($this->getImagesDir(), $relative);
     //not a file???
     if (!is_file($fullpath)) {
         return $this->getDefaultThumb();
     }
     $imgInfo = @getImageSize($fullpath);
     //not an image
     if (!is_array($imgInfo)) {
         return $this->getDefaultThumb();
     }
     //the original image is smaller than thumbnails,
     //so just return the url to the original image.
     if ($imgInfo[0] <= $this->config['thumbnail_width'] && $imgInfo[1] <= $this->config['thumbnail_height']) {
         return $this->getFileURL($relative);
     }
     $thumbnail = $this->getThumbName($fullpath);
     //check for thumbnails, if exists and
     // it is up-to-date, return the thumbnail url
     if (is_file($thumbnail)) {
         if (filemtime($thumbnail) >= filemtime($fullpath)) {
             _ddt(__FILE__, __LINE__, "getThumbnail(): returning url '" . $this->getThumbURL($relative) . "'");
             return $this->getThumbURL($relative);
         }
     }
     //well, no thumbnail was found, so ask the thumbs.php
     //to generate the thumbnail on the fly.
     return $IMConfig['backend_url'] . '__function=thumbs&img=' . rawurlencode($relative);
 }
コード例 #2
0
ファイル: backend.php プロジェクト: mambax7/xoopseditors
        include_once $IMConfig['base_dir'] . "/manager.php";
        exit;
        break;
    case "images":
        include_once $IMConfig['base_dir'] . "/images.php";
        exit;
        break;
    case "thumbs":
        include_once $IMConfig['base_dir'] . "/thumbs.php";
        exit;
        break;
    case "resizer":
        include_once $IMConfig['base_dir'] . "/resizer.php";
        exit;
        break;
    case "youtube":
        include_once $IMConfig['base_dir'] . "/youtube.php";
        exit;
        break;
    case "flickr":
        include_once $IMConfig['base_dir'] . "/flickr.php";
        exit;
        break;
    default:
        _ddt(__FILE__, __LINE__, "function request not supported");
        _error(__FILE__, __LINE__, "function request not supported");
        break;
}
// end of switch.
return false;
// END