Beispiel #1
0
 public static function get($image_url, $width = 100, $height = 100)
 {
     $ext = strrchr($image_url, '.');
     $end = intval("-" . strlen($ext));
     $real_url = substr($image_url, 0, $end) . "_{$width}_{$height}" . $ext;
     if (file_exists($real_url)) {
         return IUrl::creatUrl("") . $real_url;
     }
     return IUrl::creatUrl("") . PhotoUpload::thumb($image_url, $width, $height, "_{$width}_{$height}");
 }
Beispiel #2
0
 /**
  * @brief Éú³ÉËõÂÔͼ
  * @param string $image_url ͼƬ·¾¶
  * @param int $width ͼƬ¿í¶È
  * @param int $height ͼƬ¸ß¶È
  */
 public static function get($image_url, $width = 100, $height = 100)
 {
     if ($image_url == '') {
         return '';
     }
     $fileExt = IFile::getFileSuffix($image_url);
     $extName = "_{$width}_{$height}";
     $thumbFileName = str_replace('.' . $fileExt, $extName . '.' . $fileExt, $image_url);
     if (is_file(IWeb::$app->getRuntimePath() . $thumbFileName) == false) {
         PhotoUpload::thumb($image_url, $width, $height, "_{$width}_{$height}", IWeb::$app->getRuntimePath() . dirname($image_url));
     }
     return 'runtime/' . IWeb::$app->controller->theme . '/' . $thumbFileName;
 }