"#F0F8FF","antiquewhite"=>"#FAEBD7","aqua"=>"#00FFFF","aquamarine"=>"#7FFFD4", "azure"=>"#F0FFFF","beige"=>"#F5F5DC","black"=>"#000000","blue"=>"#0000FF","blueviolet"=>"#8A2BE2", "brown"=>"#A52A2A","burlywood"=>"#DEB887","cadetblue"=>"#5F9EA0","chartreuse"=>"#7FFF00", "chocolate"=>"#D2691E","coral"=>"#FF7F50","cornflowerblue"=>"#6495ED","cornsilk"=>"#FFF8DC", "crimson"=>"#DC143C","darkblue"=>"#00008B","darkcyan"=>"#008B8B","darkgoldenrod"=>"#B8860B", "darkgray"=>"#A9A9A9","darkgreen"=>"#006400","darkkhaki"=>"#BDB76B","darkmagenta"=>"#8B008B", "darkolivegreen"=>"#556B2F","darkorange"=>"#FF8C00","darkorchid"=>"#9932CC","darkred"=>"#8B0000", "darksalmon"=>"#E9967A","darkseagreen"=>"#8FBC8F","darkslateblue"=>"#483D8B","darkslategray"=>"#2F4F4F", "darkturquoise"=>"#00CED1","darkviolet"=>"#9400D3","deeppink"=>"#FF1493","deepskyblue"=>"#00BFFF", "dimgray"=>"#696969","dodgerblue"=>"#1E90FF","firebrick"=>"#B22222","floralwhite"=>"#FFFAF0", "forestgreen"=>"#228B22","fuchsia"=>"#FF00FF","gainsboro"=>"#DCDCDC","ghostwhite"=>"#F8F8FF", "gold"=>"#FFD700","goldenrod"=>"#DAA520","gray"=>"#808080","green"=>"#008000","greenyellow"=>"#ADFF2F", "honeydew"=>"#F0FFF0","hotpink"=>"#FF69B4","indianred"=>"#CD5C5C","indigo"=>"#4B0082","ivory"=>"#FFFFF0", "khaki"=>"#F0E68C","lavender"=>"#E6E6FA","lavenderblush"=>"#FFF0F5","lawngreen"=>"#7CFC00", "lemonchiffon"=>"#FFFACD","lightblue"=>"#ADD8E6","lightcoral"=>"#F08080","lightcyan"=>"#E0FFFF", "lightgoldenrodyellow"=>"#FAFAD2","lightgreen"=>"#90EE90","lightgrey"=>"#D3D3D3","lightpink"=>"#FFB6C1", "lightsalmon"=>"#FFA07A","lightseagreen"=>"#20B2AA","lightskyblue"=>"#87CEFA","lightslategray"=>"#778899", "lightsteelblue"=>"#B0C4DE","lightyellow"=>"#FFFFE0","lime"=>"#00FF00","limegreen"=>"#32CD32", "linen"=>"#FAF0E6","maroon"=>"#800000","mediumaquamarine"=>"#66CDAA","mediumblue"=>"#0000CD", "mediumorchid"=>"#BA55D3","mediumpurple"=>"#9370D0","mediumseagreen"=>"#3CB371", "mediumslateblue"=>"#7B68EE","mediumspringgreen"=>"#00FA9A","mediumturquoise"=>"#48D1CC", "mediumvioletred"=>"#C71585","midnightblue"=>"#191970","mintcream"=>"#F5FFFA","mistyrose"=>"#FFE4E1", "moccasin"=>"#FFE4B5","navajowhite"=>"#FFDEAD","navy"=>"#000080","oldlace"=>"#FDF5E6", "olive"=>"#808000","olivedrab"=>"#6B8E23","orange"=>"#FFA500","orangered"=>"#FF4500", "orchid"=>"#DA70D6","palegoldenrod"=>"#EEE8AA","palegreen"=>"#98FB98","paleturquoise"=>"#AFEEEE", "palevioletred"=>"#DB7093","papayawhip"=>"#FFEFD5","peachpuff"=>"#FFDAB9","peru"=>"#CD853F", "pink"=>"#FFC0CB","plum"=>"#DDA0DD","powderblue"=>"#B0E0E6","purple"=>"#800080","red"=>"#FF0000", "rosybrown"=>"#BC8F8F","royalblue"=>"#4169E1","saddlebrown"=>"#8B4513","salmon"=>"#FA8072", "sandybrown"=>"#F4A460","seagreen"=>"#2E8B57","seashell"=>"#FFF5EE","sienna"=>"#A0522D", "silver"=>"#C0C0C0","skyblue"=>"#87CEEB","slateblue"=>"#6A5ACD","slategray"=>"#708090", "snow"=>"#FFFAFA","springgreen"=>"#00FF7F","steelblue"=>"#4682B4","tan"=>"#D2B48C","teal"=>"#008080", "thistle"=>"#D8BFD8","tomato"=>"#FF6347","turquoise"=>"#40E0D0","violet"=>"#EE82EE","wheat"=>"#F5DEB3", "white"=>"#FFFFFF","whitesmoke"=>"#F5F5F5","yellow"=>"#FFFF00","yellowgreen"=>"#9ACD32"); $ThnPref=array("0"=>"THN_","1"=>"TN_"); $ThnSuff=array("0"=>"_T"); $Extensions=array( "Image"=>array("0"=>"JPG","1"=>"GIF","2"=>"PNG","3"=>"BMP","4"=>"JPEG"), "Video"=>array("0"=>"AVI","1"=>"MOV","2"=>"MVI","3"=>"WMV","2"=>"MPEG"), "Archive"=>array("0"=>"ZIP","1"=>"ARJ","2"=>"RAR")); function is_color($teststr) { global $Colors; $teststr=strtolower($teststr); if($Colors[$teststr])return $Colors[$teststr]; if((strlen($teststr)==7)&&($teststr{0}=='#')) $teststr=str_replace('#', '', $teststr); if(strlen($teststr)!=6)return false; if(strspn($teststr,"0123456789abcdef")!=6)return false; return '#'.strtoupper($teststr); } function ColVal($H,$M1,$M2) { if($H<0)$H=$H+1; elseif($H>1)$H=$H-1; if((6*$H)<1) $V=$M1+($M2-$M1)*$H*6; elseif((2*$H)<1) $V=$M2; elseif((3*$H)<2) $V=$M1+($M2-$M1)*(2/3-$H)*6; else $V=$M1; return(round(255*$V)); } function hsl2RGB($hsl) { if($hsl[s]==0) { $R=round(255*$hsl[l]); $G=$R; $B=$R; } else { if($hsl[l]<=0.5) $m2=$hsl[l]*(1+$hsl[s]); else $m2=($hsl[l]+$hsl[s])-($hsl[l]*$hsl[s]); $m1=2*$hsl[l]-$m2; $R=ColVal($hsl[h]+1/3,$m1,$m2); $G=ColVal($hsl[h],$m1,$m2); $B=ColVal($hsl[h]-1/3,$m1,$m2); } return '#'.sprintf("%02X%02X%02X",$R,$G,$B); } function RGBByteToReal($B) { return(($B+1/2)-(128-$B)/255)/256; } function RGB2hsl($RGBcolor) { $hexcolor = str_replace('#', '', $RGBcolor); $r=RGBByteToReal(hexdec(substr($hexcolor, 0, 2))); $g=RGBByteToReal(hexdec(substr($hexcolor, 2, 2))); $b=RGBByteToReal(hexdec(substr($hexcolor, 4, 2))); $Cmax=max($r,max($g,$b)); $Cmin=min($r,min($g,$b)); $Lum=($Cmax+$Cmin)/2; if($Cmax==$Cmin) { $Hue=0; $Sat=0; } else { $D=$Cmax-$Cmin; if($Lum<0.5) $Sat=$D/($Cmax+$Cmin); else $Sat=$D/(2-$Cmax-$Cmin); if($r==$Cmax) $Hue=($g-$b)/$D; elseif($g==$Cmax) $Hue=2+($b-$r)/$D; else $Hue=4+($r-$g)/$D; $Hue=$Hue/6; if($Hue<0) $Hue=$Hue+1; } $hsl=array( 'h'=>$Hue, 's'=>$Sat, 'l'=>$Lum ); return $hsl; } function StrParsePart($haystack,$needle,$forparse) { $haytail=strstr($haystack,"="); if(!$haytail)return ""; $haytail=trim(substr($haytail,1)); if ($haytail=="")return ""; $haystack=strtolower(trim(substr($haystack,0,strpos($haystack,"=")))); $needle=strtolower($needle); while($needle!="") { if(strstr($needle,"|")) { $subneedle=substr($needle,0,strpos($needle,"|")); $needle=substr(strstr($needle,"|"),1); } else { $subneedle=$needle; $needle=""; } if($haystack!=$subneedle)continue; $haytail=str_replace('&','&',$haytail); $haytail=str_replace('"','"',$haytail); $haytail=str_replace("'",''',$haytail); if($forparse==true) return $subneedle."=".$haytail; else return $haytail; } return ""; } function FileNam($filename) { return substr($filename,0,strrpos($filename,'.')); } function FileExt($filename) { $rpos=strrpos($filename,'.'); if($rpos) return substr($filename,$rpos+1,strlen($filename)-$rpos-1); else return ""; } function is_Thumbnail($NAM) { global $ThnPref; for($i=0;$i50000)$sharpen=0; if(function_exists('imageCreateTrueColor')) $thn=imageCreateTrueColor($thnwid,$thnhei); else { $sharpen=0; $thn=imageCreate($thnwid,$thnhei); } if(function_exists('imagecopyresampled')) imagecopyresampled($thn, $src, 0, 0, 0, 0, $thnwid, $thnhei, $images[0][wht][0], $images[0][wht][1]); else imagecopyresized($thn, $src, 0, 0, 0, 0, $thnwid, $thnhei, $images[0][wht][0], $images[0][wht][1]); imagedestroy($src); if($sharpen>0) { $s=min($sharpen,100)/200; $s1=$s/2; for($j=0;$j<$thnhei;$j++) for($i=0;$i<$thnwid;$i++) { $pix=ImageColorAt($thn,$i,$j); for($k=0;$k<3;$k++) { $rgb[$i][$j][$k]=$pix & 0xFF; $pix=$pix>>8; } } for($j=0;$j<$thnhei;$j++) { $u=Max($j-1,0); $d=Min($j+1,$thnhei-1); for($i=0;$i<$thnwid;$i++) { $l=Max($i-1,0); $r=Min($i+1,$thnwid-1); for($k=0;$k<3;$k++) { $p[$k]=$rgb[$i][$j][$k]; $p4=$p[$k]<<2; $cd=($p4-$rgb[$l][$u][$k]-$rgb[$r][$u][$k]-$rgb[$l][$d][$k]-$rgb[$r][$d][$k])*$s1; $nd=($p4-$rgb[$i][$u][$k]-$rgb[$l][$j][$k]-$rgb[$r][$j][$k]-$rgb[$i][$d][$k])*$s; $p[$k]=Min(255,Max(0,Round($p[$k]+$nd+$nd))); } imageSetPixel($thn,$i,$j,imageColorAllocate($thn,$p[2],$p[1],$p[0])); } } // I must commend myself, this works great! } if($gamma>0) { $GammaFloat=(double)1+min($gamma,30)/100; imagegammacorrect($thn,1.0,$GammaFloat); } $savName=$images[0][tnfile]=$images[0][tnfile].'.'.$Extensions[Image][$thnext]; switch($thnext) { case 0: @imageJPEG($thn,$savName,$quality);break; case 1: @imageGIF($thn,$savName);break; case 2: @imagePNG($thn,$savName);break; } if($f=@fopen($savName,"r")) { $images[0][tnw]=$thnwid; $images[0][tnh]=$thnhei; imageDestroy($thn); fClose($f); return ""; } return "distant directory write-enable attribute is OFF.
Solution: change all write attributes to ON value!"; } // $hst=parse_url("{$HTTP_HOST}{$REQUEST_URI}"); // $url="http://".$hst[host].$hst[path]; $url="http://".$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF']; $phpselfUFN=strtoupper(FileNam(substr($url,strrpos($url,'/')+1,strlen($url)))); $thispath=substr($url,0,strrpos($url,'/')+1); $title= "{$HTTP_HOST}"; $charset= "iso-8859-1"; $background= ""; $defbkgfile= ""; $heading= "Photo Gallery"; $headingcolor= ""; $headingfontfamily= ""; $headingfontweight= "bold"; $headingfontsize= "18pt"; $headingshadow= "yes"; $basecolor= ""; $columns= 5; $rows= 4; $empty= "empty"; $page= "Page"; $prev= "Prev."; $next= "Next"; $home= "Home"; $homepage= ""; $loading= "Loading image..."; $clicktoclose= "click the picture to close"; $copyright= ""; $autocreation= "no"; $maxwidth= 128; $maxheight= 0; $sharpen= 0; $gamma= 0; $quality= 75; $inifile= ""; $inisecnames=array("","[MAIN]","[WINDOW]","[BODY]","[TABLE]","[SUBWIN]","[THUMBNAILS]","[IMAGES]"); $logfile= "yes"; $handle=opendir("."); while ($file=readdir($handle)) { if(($file=='..')||($file=='.'))continue; if(!is_file($file))continue; $upcstr=strtoupper($file); $upcfnm=FileNam($upcstr); $upcext=FileExt($upcstr); if($upcext=="INI") { if(($inifile=="")||($upcfnm==$phpselfUFN)||(($upcfnm=="INDEX")&&(FileNam($inifile)!=$phpselfUFN))) $inifile=$file; continue; } if(is_Background($file)) if(is_imageext($upcext)) if(($defbkgfile=="")||(strlen($file)==14)) { $defbkgfile=$file; // continue; } if(!is_supportedext($upcext)) continue; if($thnufn=is_Thumbnail($upcfnm)) { $thumbnails[count($thumbnails)][tnfile]=$file; $thumbnails[count($thumbnails)-1][FNM]=$thnufn; continue; } $i=count($images); $images[$i][tnfile]=""; $images[$i][tnw]=0; $images[$i][tnh]=0; $images[$i][file]=$file; $images[$i][FNM]=$upcfnm; $images[$i][EXT]=$upcext; $images[$i][tit]=$file; } closedir($handle); $tnwmax=0;$tnhmax=0; for ($j=0;$j0) sort($images); while ((count($images)>0)&&($images[0][tnfile]=="")) { if(is_true($autocreation)) { $maxwidth=min(320,max(40,$maxwidth)); if(!$maxheight)$maxheight=round($maxwidth*3/4); $maxheight=min(320,max(30,$maxheight)); $images[0][wht]=@getimagesize($images[0][file]); if($images[0][wht]=@getimagesize($images[0][file])) if(($images[0][wht][2]>=1)&&($images[0][wht][2]<=3)&&(!is_Background($images[0][file]))) { $result=CreateThumbnail($images[file]); $title="PhalGen thumbnails creator"; echo" $title
$title

source image: {$images[0][file]}
thumbnail file: {$images[0][tnfile]}
"; if($result=="") { echo"
{$images[0][tnfile]}

"; $result='creation successful'; } else $result='
ERROR: Could not create the thumbnail!
Possible reason: '.$result; echo"$result
"; sleep(1); die(); } } array_shift($images); } if(is_true($logfile))$logfile="visitors.log"; elseif(is_false($logfile))$logfile=""; if($logfile) { if($ip=@getenv("REMOTE_ADDR")); else if($ip=@getenv("HTTP_CLIENT_IP")); else $ip=@getenv("HTTP_X_FORWARDED_FOR"); if($fp=@fopen($logfile,"a")) { if(!$ip) {$ip="can't detect IP";$hostbyip="";} else if(!$hostbyip=@gethostbyaddr($ip)) $hostbyip="can't detect host by ip"; fPutS($fp,date('Y-m-d H:i:s')." ".$ip." ".$hostbyip."\r\n"); fClose($fp); } } if($columns<2)$columns=2; $thncnt=$rows*$columns; $pgscnt=1+intval((count($images)-1)/$thncnt); // $pageno=$HTTP_GET_VARS["p"]; $pageno=$_GET["p"]; if($pageno<1) $pageno=1; if($pageno>$pgscnt) $pageno=$pgscnt; $firstthn=($pageno-1)*$thncnt; $prevpage="?p=".strval($pageno-1); if ($pageno==2) $prevpage=""; $nextpage="?p=".strval($pageno+1); $copyright=str_replace("(c)","©",$copyright); if (!$background)$background=$defbkgfile; $basecolor=is_color($basecolor); $bgcolor=is_color($background); if(!$bgcolor) { if(file_exists($background)) { if($bgcolor=is_color(substr(substr($background,0,strlen($background)-4),strrpos($background,'_')+1,strlen($background)))) if(!$basecolor) $basecolor=$bgcolor; $bgcolor=''; } } if(!$basecolor) $basecolor='#B0B0B0'; $hsl=RGB2hsl($basecolor); $sb=$hsl[s]; $lb=$hsl[l]; $hsl[l]=max(0.3,min(0.85,$hsl[l])); $hsl[s]=min(0.75,$hsl[s]); if(($lb!=$hsl[l])||($sb!=$hsl[s])) { $basecolor=hsl2RGB($hsl); $sb=$hsl[s]; $lb=$hsl[l]; } $l0=-5; $l1=11; $s0=-10; $s1=9; for ($i=0; $i<10; $i++) { if($i<5) { $lkoef=($i-$l0)/(5-$l0); $skoef=($i-$s0)/(5-$s0); } elseif($i>5) { $lkoef=1+((1-$lb)*($i-5))/($l1-5); $skoef=1+((1-$sb)*($i-5))/($s1-5); } else { $lkoef=1; $skoef=1; } $hsl[l]=$lb*$lkoef; $hsl[s]=$sb*$skoef; $tnc[$i]=hsl2RGB($hsl); } $userAgent=strtoupper($HTTP_USER_AGENT); //$mozilla=(strpos($useragent,"OZILLA")==1)&&(!strpos($userAgent."COMPATIBLE")); $opera=strpos($userAgent,"OPERA")>0; //$ie=!$mozilla&&!$opera; if(!$headingcolor=is_color($headingcolor)) $headingcolor=$tnc[9]; if(is_false($headingshadow)||$opera)$headingshadow=false; elseif(!is_color($headingshadow)) $headingshadow="black"; $s1="solid 1px "; $s2="solid 2px"; $b="border"; $n="none"; $bl=$b."-left:"; $bt=$b."-top:"; $br=$b."-right:"; $bb=$b."-bottom:"; $bn=$b.":".$n; $bgc="background-color:"; echo" $title "; ?>

"; if($headingshadow) echo" $heading"; echo" $heading"; if($headingshadow) echo""; echo"

"; //============================================== if($pgscnt>1)$rs='9';else $rs='3'; for($j=0; $j<=3; $j++) { $lt=8-$j; echo"1) echo" COLSPAN='3'"; echo" HEIGHT='6'>"; } if ($pgscnt>1) { $cellwid=($tnwmax+9)*$columns-1; echo" "; } echo" 1) echo" COLSPAN='3'"; echo">
$page:  "; for ($i=1; $i<=$pgscnt; $i++) { if ($i==$pageno) { echo"  $pageno"; } else { $href=$url."?p="."$i"; if($i==1) $href=$url; echo"  $i"; } } echo"
"; $NoiNo=0; for ($i=$firstthn; $i<=$firstthn+$thncnt-1; $i++) { if (($i)%$columns==0) { if ($i!=$firstthn) echo""; echo" "; } if($i
{$images[$i][tnfile]}"; } else { $NoiNo=$NoiNo+1; $timerID='timer'.$NoiNo; $EXT=$images[$i][EXT]; echo" STYLE=\"background-image:url('{$images[$i][tnfile]}');\" WIDTH='{$images[$i][tnw]}' HEIGHT='{$images[$i][tnh]}' ALIGN='CENTER' ONMOUSEOVER=\"if(typeof $timerID!='undefined')clearTimeout($timerID);ShowHide('$NoiNo',1);\" ONMOUSEOUT=\"$timerID=setTimeout('ShowHide(\'$NoiNo\',0)',250);\">
$EXT
"; } echo ""; } else echo" TITLE='$empty'>"; for ($j=1; $j<=$jj; $j++) { $sp=substr($sp,0,strlen($sp)-3); echo""; } } echo" "; if ($pgscnt>1) { echo" "; for ($i=0; $i<=1; $i++) { if ($i==0) { $lr='l'; $ali='LEFT'; $val='< '.$prev.' '; } else { $lr='r'; $ali='RIGHT'; $val=' '.$next.' >'; } $dis=(($i==0)&&($pageno==1))||(($i==1)&&($pageno==$pgscnt)); echo"
"; if ($i==0) echo" "; } echo" "; } echo"
"; for ($j=1; $j<=3; $j++) echo"
 {$val} 
"; for ($j=1; $j<=4; $j++) {echo"
";} echo"
"; if ($homepage) { if(!((strpos($homepage,'.')
  {$home}  "; for ($j=1; $j<=3; $j++) echo"
"; } echo"

Created by PhalGen (php Photoalbum Generator) PhalGen ver. $version © teosoft.cz 2004

"; echo" "; echo" ";?>