public static function getThumbImageUrl($attach, $width, $height) { $attachUrl = FileUtil::getAttachUrl(); $thumbName = self::getThumbName($attach, $width, $height); $thumbUrl = FileUtil::fileName($thumbName); if (FileUtil::fileExists($thumbUrl)) { return $thumbName; } else { $attachment = $attach["attachment"]; $file = $attachUrl . "/" . $attachment; $imgext = AttachUtil::getCommonImgExt(); if (FileUtil::fileExists($file)) { $info = ImageUtil::getImageInfo(FileUtil::fileName($file)); $infoCorrect = is_array($info) && in_array($info["type"], $imgext); $sizeCorrect = $infoCorrect && ($width < $info["width"] || $height < $info["height"]); if ($infoCorrect && $sizeCorrect) { $returnUrl = self::makeThumb($attach, $width, $height); } else { $returnUrl = $attachUrl . "/" . $attachment; } } else { $returnUrl = FileUtil::fileName($file); } return $returnUrl; } }