|
@@ -84,13 +84,13 @@ class util
|
|
|
return del_incr('global_incr',$key,'mb_');
|
|
|
}
|
|
|
|
|
|
- static function start_with($haystack, $needle)
|
|
|
+ public static function start_with($haystack, $needle)
|
|
|
{
|
|
|
$length = strlen($needle);
|
|
|
return (substr($haystack, 0, $length) === $needle);
|
|
|
}
|
|
|
|
|
|
- static function end_with($haystack, $needle)
|
|
|
+ public static function end_with($haystack, $needle)
|
|
|
{
|
|
|
$length = strlen($needle);
|
|
|
if ($length == 0) {
|
|
@@ -99,4 +99,20 @@ class util
|
|
|
|
|
|
return (substr($haystack, -$length) === $needle);
|
|
|
}
|
|
|
+ public static function imgsize($url)
|
|
|
+ {
|
|
|
+ if (util::start_with($url,BASE_SITE_URL) == false) {
|
|
|
+ return @getimagesize($url);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $length = strlen(BASE_SITE_URL);
|
|
|
+ $src = BASE_ROOT_PATH . substr($url, $length, strlen($url) - $length);
|
|
|
+ $size = @getimagesize($src);
|
|
|
+ if($size == false) {
|
|
|
+ return @getimagesize($url);
|
|
|
+ } else {
|
|
|
+ return $size;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|