Instalace je velice jednoduchá. Stažený soubor uložíte na Váš web do adresáře: \plugins\hcm. Tam vytvoříte adresář hacesoft a do něho uložíte soubor gallery3.php a function.php.
Do template.php aktivní layout za tág
function ZmenStav(jak) {
if(jak==1) {
document.getElementById('text_gallery3').style.visibility='hidden';
document.getElementById('gallery3_div').style.display='block';
}
else {
document.getElementById('text_gallery3').style.visibility='visible';
document.getElementById('gallery3_div').style.display='none';
}
}
</SCRIPT>
Nakopírujte tyto CSS tagy do layout.css
border : 1px solid rgb(0, 0, 0);
}
#gallery3_div {
display: none;
}
#text_gallery3 {
text-align : center;
padding : 2px 0 2px 0;
margin : 10px auto 10px auto;
}
.text_gallery3 {
color : black;
border : 1px solid rgb(180, 180, 180);
background-color : #f1c97c;
text-align : center;
width : auto;
font-size : 11px;
}
#gallery3 {
margin : auto auto 10px auto;
border : 1px solid rgb(164, 164, 164);
width : 550px;
text-align : center;
}
#gallery3 td {
color : black;
text-align : left;
border-bottom : 1px solid #a8f7f7;
padding-bottom : 3px;
}
#gallery3 th {
text-align : center;
font-size : 18px;
}
HCM modul použijete následovně:
První parametr ukazuje na adresář disku, kde se nacházejí zobrazitelné fotky, druhý parametr je velikost náhledu.
HCM kód gellery3 modulu:
// Autor www.prochazka.zde.cz
// Tento kod lze neomezene pouzivat pro NEKOMERCNI UCELY!!!
//tato galerie zobrazuje i exif informace z obrazku...
// version 1.2.0. ze dne -> 29.06.2008 : 10:55
// version 1.3.0. ze dne -> 26.12.2012 : 15:51 --predelani kodu na HCM modul
if(!defined('_core')) exit;
require _indexroot."plugins/hcm/hacesoft/function.php";
function _HCM_hacesoft_gallery3($sDirPic="", $nSize="96")
{
$mresult ="";
if (isset($_GET['g3'])){//galerie3x po vyberu obrazku
$k = 0;
$pBuffer = explode("߀", Dekodovani_Dat($_GET['g3']));
if (isset($pBuffer[0])) {
$id = $pBuffer[0];
$k = $k + 1;
}
if (isset($pBuffer[1])) {
$sCrc = $pBuffer[1];
$k = $k + 1;
}
if ($k == 2) {
if ($sCrc == CrcOrign()) {
return (Hexif_read_file($pBuffer[0])); //print select picture
}
}
}
$langExif['exif.Prev']="Zobrazit obrázek";
$CestakPrevHacFunkci =GetAdr()."&g3=";
if (!function_exists("exif_read_data")) {
$mresult .= "<table><tr><td><b>Pro funkci tohoto modulu je nutno povolit v PHP.INI knihovnu extension=php_exif.dll, a nezapomen nacist taky mbstring! + mbstring musi byt nactena drive nez exif!</b></td></tr></table>";
return $mresult;
}
if (mb_substr($sDirPic, -1, 1) != "/") {
$sDirPic .= "/";
}
$allowed_extensions = array("gif", "jpg", "jpeg", "png");
if (file_exists($sDirPic)and is_dir($sDirPic)) {
$handle = @opendir($sDirPic);
$items = array();
while ($item = @readdir($handle)) {
$ext = pathinfo($item);
if (isset($ext['extension'])) {
$ext = mb_strtolower($ext['extension']);
} else {
$ext = "";
}
if (is_dir($item)or$item == "."or$item == ".."or!in_array($ext, $allowed_extensions)) {
continue;
}
$items[] = $item;
}
natsort($items);
$altExif="";
foreach($items as $item) {
$sBuffer = Kodovani_Dat($sDirPic.$item . '߀' . CrcOrign());
$mresult .= "<a href='".$CestakPrevHacFunkci.$sBuffer."' ><img src='".$sDirPic.$item."' height='".$nSize."' alt='".$langExif['exif.Prev']."' /></a>";
}
@closedir($handle);
}
return $mresult;
}
function Hexif_read_file ($SFullPath=""){
$hExif=exif($SFullPath);
if ($hExif == -1) {return;} //selhala funkce exif, spatna cesta k souboru
if ($hExif["COMPUTED"]["Width"] > 1024) {$width_pic = 1024;}
else {$width_pic = $hExif["COMPUTED"]["Width"];}
$mresult = "<img id='gallery3_img' src='".$SFullPath."' width='".$width_pic."' alt='".$hExif["FileName"]."'>";
if (file_exists("$SFullPath")) {
$sSize=formatfilesize(FileSize("$SFullPath"));
$sDatumNew = date ("j.n.Y H:i:s", filemtime("$SFullPath"));
}
$mresult .= "<div id='text_gallery3' style='width: 550px; ' class='text_gallery3' onclick='ZmenStav(1)'>".$langExif['galery3.Show']."</div>
<div id='gallery3_div'><table id='gallery3'>
<tr><th colspan='2'>".$langExif['galery3.Information']."</th></tr>
<tr><td width='30%'>".$langExif['exif.Size']."</td><td width='70%'>".$sSize."</td></tr>
<tr><td width='30%'>".$langExif['galery3.Time']."</td><td width='70%'>".$sDatumNew."</td></tr>";
if($hExif==-1){$mresult.= "<tr><th colspan='2'>".$langExif['exif.NotFunction']."</th></tr>";}
else {$mresult .= "<tr><th colspan='2'>".$langExif['galery3.Exif']."</th></tr>";}
if($hExif==false){$altExif="<tr><th colspan='2'>".$langExif['exif.NotData']."</th></tr>";}
else{
$mresult .= "<tr><td width='30%'>". $langExif['exif.Definition']."</td><td width='70%'>".$hExif["COMPUTED"]["Width"]."×".$hExif["COMPUTED"]["Height"]."</td></tr>";
if (isset($hExif["Flash"])){
$flash= decbin($hExif["Flash"]);
$sBuffer="";
if (strlen($flash)>=1){
$flashx=substr($flash,-1,1);
$sBuffer=$langExif["exif.Flash".$flashx];
if (strlen($flash)>=3){$flashxx=substr($flash,-3,2);
$sBuffer .= " (".$langExif["exif.Flash".$flashxx].")";
}
}
}
else{$sBuffer ="N/A";}
$mresult .= "<tr><td width='30%'>". $langExif['exif.Flash']."</td><td width='70%'>".$sBuffer."</td></tr>";
if (isset($hExif["ExposureProgram"])){$sBuffer = $hExif["ExposureProgram"];}else{$sBuffer ="0";}
$mresult .= "<tr><td width='30%'>". $langExif['exif.ExposureProgram']."</td><td width='70%'>".$langExif['exif.ExposureProgramArray'][$sBuffer]."</td></tr>";
if (isset($hExif["MeteringMode"])){$sBuffer = $hExif["MeteringMode"];}else{$sBuffer ="0";}
$mresult .= "<tr><td width='30%'>". $langExif['exif.MeteringMode']."</td><td width='70%'>".$langExif['exif.MeteringModeArray'][$sBuffer]."</td></tr>";
if (isset($hExif["ExposureBiasValue"])){$sBuffer = $hExif["ExposureBiasValue"];}else{$sBuffer ="N/A";}
$mresult .= "<tr><td width='30%'>". $langExif['exif.ExposureBiasValue']."</td><td width='70%'>".ExifNumber($sBuffer)."</td></tr>";
if (isset($hExif["WhiteBalance"])){$sBuffer = $hExif["WhiteBalance"];}else{$sBuffer ="N/A";}
$mresult .= "<tr><td width='30%'>". $langExif['exif.WhiteBalance']."</td><td width='70%'>".$sBuffer." EV</td></tr>";
if (isset($hExif["MaxApertureValue"])){$sBuffer = $hExif["MaxApertureValue"];}else{$sBuffer ="N/A";}
$mresult .= "<tr><td width='30%'>". $langExif['exif.MaxApertureValue']."</td><td width='70%'>".ExifNumber($sBuffer)."</td></tr>";
if (isset($hExif["LightSource"])){$sBuffer = $hExif["LightSource"];}else{$sBuffer ="0";}
$mresult .= "<tr><td width='30%'>". $langExif['exif.LightSource']."</td><td width='70%'>".$langExif["exif.LightSourceArray"][$sBuffer]."</td></tr>";
if (isset($hExif["ExposureTime"])){$sBuffer = $hExif["ExposureTime"];}else{$sBuffer ="N/A";}
$mresult .= "<tr><td width='30%'>". $langExif['exif.TimeExposition']."</td><td width='70%'>".ExifNumber($sBuffer)."</td></tr>";
if (isset($hExif["ISOSpeedRatings"])){$sBuffer = $hExif["ISOSpeedRatings"];}else{$sBuffer ="N/A";}
$mresult .= "<tr><td width='30%'>". $langExif['exif.SensitivyISO']."</td><td width='70%'>".$sBuffer."</td></tr>";
if (isset($hExif["FocalLength"])){$sBuffer = $hExif["FocalLength"];}else{$sBuffer ="N/A";}
$mresult .= "<tr><td width='30%'>". $langExif['exif.FocalLenght']."</td><td width='70%'>".ExifNumber($sBuffer)."</td></tr>";
if (isset($hExif["DateTime"])){$sBuffer = $hExif["DateTime"];}else{$sBuffer ="N/A";}
$mresult .= "<tr><td width='30%'>". $langExif['exif.DateTime']."</td><td width='70%'>".$sBuffer."</td></tr>";
if (isset($hExif["Make"])){$sBuffer = $hExif["Make"];}else{$sBuffer ="N/A";}
if (isset($hExif["Model"])){$sBuffer1 = $hExif["Model"];}else{$sBuffer1 ="";}
$mresult .= "<tr><td width='30%'>". $langExif['exif.Marke']."</td><td
width='70%'>".$sBuffer." ". $sBuffer1."</td></tr>";
if (isset($hExif["Make"]["ApertureFNumber"])){$sBuffer = $hExif["Make"]["ApertureFNumber"];}else{$sBuffer ="N/A";}
$mresult .= "<tr><td width='30%'>". $langExif['exif.ApertureFNumber']."</td><td
width='70%'>".$sBuffer."</td></tr>";
}
$mresult .= "<tr><th colspan='2' align='center'><div onclick='ZmenStav(2)'
class='text_gallery3'>".$langExif['galery3.Hide']."</div></th></tr></table></div>";
return $mresult;
}
function exif($soubor){
if (!function_exists("exif_read_data")) {return -1;}
$exif= exif_read_data($soubor);
if($exif==false){return 0;}
else {return $exif; }
}
function ExifNumber($sBuffer){
if ($sBuffer =="N/A") {return $sBuffer;}
$pBuffer = explode("/", $sBuffer);
return $pBuffer[0]/$pBuffer[1]. " (".$sBuffer.")";
}
?>
Stáhnout HCM modul: gallery3.php.
Komentáře
Nebyly přidány žádné komentáře.