1.
<?php
2.
$__pth
=
str_replace
(
$_SERVER
[
'DOCUMENT_ROOT'
],
""
,
str_replace
(
"\\","
/
",dirname(__FILE__)));if($__jq){echo'<script src="
'.
$__pth
.
'/js/jquery.js"></script>'
;}
echo
'<script src="'
.
$__pth
.
'/js/jquery.IMGallery.js"></script><script>$(document).ready(function(){$("a[rel^=\'IMGallery\']").IMGallery();});</script><link rel="stylesheet" href="'
.
$__pth
.
'/css/IMGallery.css">'
;
$__thumb_w
="
";$__thumb_h=80;function gallery_thumb_size($width,$height){global $__thumb_w,$__thumb_h;$__thumb_w=intval($width);$__thumb_h=intval($height);}function gallery_thumb_width($width){global $__thumb_w,$__thumb_h;$__thumb_w=intval($width);$__thumb_h="
";}function gallery_thumb_height($height){global $__thumb_w,$__thumb_h;$__thumb_h=intval($height);$__thumb_w="
";}$__rand_nums=array();function __gallery_get_num(){global $__rand_nums;$n=0;do{$n=rand(1000,9999);}while(in_array($n,$__rand_nums));array_push($__rand_nums,$n);return $n;}function gallery_add_set(&$set,$file,$title="
",$description="
"){array_push($set,array($file,$title,$description));}function gallery_new_set(){return array();}function gallery_echo_set($set){global $__thumb_w,$__thumb_h;$n=count($set);if($n==0){return;}elseif($n==1){__gallery_echo(0,$set[0][0],$set[0][1],$set[0][2]);}elseif($n>1){$rand=__gallery_get_num();for($i=0;$i<$n;$i++){__gallery_echo($rand,$set[$i][0],$set[$i][1],$set[$i][2]);}}}function gallery_echo_img($file,$title="
",$description="
"){__gallery_echo(0,$file,$title,$description);}function __gallery_echo($num,$file,$title="
",$desc="
"){global $__thumb_w,$__thumb_h;$desc=trim($desc);if($desc=="
"||$desc==null){$pth=pathinfo($file);$desc=$pth['filename'];}$w="
";$h="
";if($__thumb_w!="
"){$w="
width=\
"$__thumb_w\""
;}
if
(
$__thumb_h
!=
""
){
$h
=
" height=\"$__thumb_h\""
;}
$g
=
"[$num]"
;
if
(
$num
==0){
$g
=
""
;}
echo
'<a href="'
.
$file
.
'" rel="IMGallery'
.
$g
.
'" title="'
.
$desc
.
'"><img src="'
.
$file
.
'" alt="'
.
$title
.
'"'
.
$w
.
$h
.
'"></a>'
;}
function
gallery_echo_dir(
$dir
,
$type
="gif,jpg,jpeg,png
"){if(!is_dir($dir)){return;}$t=explode("
,
",preg_replace("
/(\s{1,})|(\.)/i
","
",strtolower($type)));$d=opendir($dir);$set=gallery_new_set();while($f=readdir($d)){$p=pathinfo($f);if(in_array($p['extension'],$t)){gallery_add_set($set,"
$dir
/
$f
");}}gallery_echo_set($set);}function gallery_thumb_margin($length){$length=intval($length);$x=intval($length/2)."
px
";$y=$length."
px
";echo"
<script>\$(
function
(){\$(
'a[rel^=IMGallery]>img'
).css(
'margin'
,
'$x $y'
);});</script>
";}$__border_style="
none
";$__border_width="
0px
";$__border_color="
#fff
";function gallery_thumb_border($style,$width,$color){global $__border_style,$__border_width,$__border_color;$width=intval($width)."
px
";echo"
<script>\$(
function
(){\$(
'a[rel^=IMGallery]>img'
).css(
'border'
,
'$style $width $color'
);});</script>
";$__border_style=$style;$__border_width=$width;$__border_color=$color;}function gallery_thumb_hover_border($style,$width,$color){global $__border_style,$__border_width,$__border_color;$width=intval($width)."
px
";echo"
<script>\$(
function
(){\$(
'a[rel^=IMGallery]>img'
).hover(
function
(){\$(this).css(
'border'
,
'$style $width $color'
);},
function
(){\$(this).css(
'border'
,
'$__border_style $__border_width $__border_color'
);})});</script>";}
3.
?>