I nostri album

Guarda qui tutte le foto dei nostri lavori sempre in aggiornamento!

sortkeys[$i][0]],$b[$this->sortkeys[$i][0]]); if ($this->sortkeys[$i][1] == "DESC") $r = $r * -1; if($r==0) { $i++; if ($this->sortkeys[$i]) $r = $this->_sortcmp($a, $b, $i); } return $r; } function sort() { if(count($this->sortkeys)) { usort($this->data,array($this,"_sortcmp")); } } } // function savegals($gal, $galfile) // { // $fp = fopen($galfile, "w"); // ksort($gal); // foreach($gal as $g) // { // fputs($fp, "$g[0]|$g[1]"); // // for($i = 2; $i < count($g);$i++) // { // fputs($fp, "|$g[$i]"); // } // fputs($fp, "\n"); // } // //fputs($fp, "$g[0]|$g[1]|$g[2]\n"); // // fclose($fp); // } //========================================================================= /*function adminloggedin($logfile) { include($logfile); $logged = false; if (count($admins) > 0) { foreach ($admins as $line) { if ($line['hash'] == md5($_REQUEST['mghash'])) $logged=true; } } return $logged; } function clearoldadmins($logfile, $now) { global $mgConf; include($logfile); if (count($admins)>0) { $i=0; $fp=fopen($logfile, "w"); fputs($fp, ""); fclose($fp); } }*/ //========================================================================= //crea le anteprime function mkthumbnail($src, $dst, $mode="w", $width, $height, $quality=80, $watermark=false){ $info = getimagesize($src); $cropmode = false; global $mgConf; if ($info[2] == 2){ // if it's jpg $srcx = 0; $srcy = 0; $srcw = $info[0]; $srch = $info[1]; $destw = $width; $desth = $height; if ($mode == "w"){ $destw = $width; $desth = round(($info[1]*$width)/$info[0], 0); }else if ($mode == "h"){ $desth=$height; $destw=round(($info[0]*$height)/$info[1], 0); }else if ($mode == "m"){ // landscape if ($srcw > $srch){ $destw = $width; $desth = round(($info[1]*$width)/$info[0], 0); // portrait }else{ $desth=$height; $destw=round(($info[0]*$height)/$info[1], 0); } // crop image }else if ($mode == "c"){ // thumb is square if ($width == $height){ if ($srcw > $srch) $cropmode = "w"; else $cropmode = "h"; // thumb is landscape }else if ($width > $height){ $cropmode = "h"; // thumb is portrait }else{ $cropmode = "w"; } if ($cropmode == "w"){ $srcw = round(($width*$srch) / $height, 0); $srcx = floor(($info[0] - $srcw) / 2); }else if ($cropmode == "h"){ $srch = round(($height*$srcw) / $width, 0); $srcy = floor(($info[1] - $srch) / 2); } } $src_p=imagecreatefromjpeg($src); $dst_p=imagecreatetruecolor($destw, $desth); imagecopyresampled($dst_p, $src_p, 0, 0, $srcx, $srcy, $destw, $desth, $srcw, $srch); // add watermark if ($watermark === true && $mgConf['watermarkimg'] != ""){ waterMark($dst_p, $mgConf['watermarkimg']); } imagejpeg($dst_p, $dst, $quality); imagedestroy($src_p); imagedestroy($dst_p); return true; }else return false; } //Function per la firma function waterMark(&$sourcefile_id, $watermarkfile) { global $mgConf; $watermarkfile = $mgConf['serverpath']."/".$watermarkfile; //Get the resource ids of the pictures $watermarkfile_id = imagecreatefrompng($watermarkfile); imageAlphaBlending($watermarkfile_id, false); imageSaveAlpha($watermarkfile_id, true); // get destination position of wm image $dest_x = ($mgConf['watermark_x'] < 0) ? imagesx($sourcefile_id) + $mgConf['watermark_x'] : $mgConf['watermark_x']; $dest_y = ($mgConf['watermark_y'] < 0) ? imagesy($sourcefile_id) + $mgConf['watermark_y'] : $mgConf['watermark_y']; imagecopy($sourcefile_id, $watermarkfile_id, $dest_x, $dest_y, 0, 0, imagesx($watermarkfile_id), imagesy($watermarkfile_id)); } //Ritorna la lista delle foto nella cartella function getpics($gal, $imgdir) { global $mgConf; $dir="$imgdir$gal"; $dp=opendir($dir); $pictures= new mdasort; $i=0; while ($file=readdir($dp)) { if ($file!="." && $file!="..") { if (strpos($file, "thumb")===false/* && $file!="captions.dat"*/) { if(substr($file,-strlen("jpg")) == "jpg") { $pictures->data[$i]['id'] = substr($file, 0, strrpos($file, ".")); $pictures->data[$i]['pic'] = $mgConf['pathtoscript']."images/$gal/$file"; if ($mgConf['thumbnails']) $pictures->data[$i]['thumb'] = $mgConf['pathtoscript']."images/$gal/thumb_$file"; $i++; } } } } if ($i > 0) { $pictures->sortkeys = array(array('id','ASC')); $pictures->sort(); return $pictures->data; } else return false; } function getImageName($gal, $name) { global $imgdir, $mgConf; $name = substr($name, 0, strrpos($name, ".")); $name = strtolower(preg_replace("/[^a-zA-Z0-9]/", "_", $name)).".jpg"; $images = getpics($gal, $imgdir, $mgConf['pathtoscript'], $mgConf['thumbnails']); if (is_array($images)) { foreach ($images as $img){ // if file exists rename it if ($img['id'].".jpg" == $name) { $version=1; $versionext=""; while(file_exists($imgdir.$gal."/".$name)) { $name=substr($name, 0, strrpos($name, "$versionext."))."_$version".substr($name, strrpos($name, ".")); $versionext="_$version"; $version++; } } } } return substr($name, 0, strrpos($name, "."));; } //Recupera il caption delle foto function getcaps($gal, $imgdir,$lang = "") { if(strlen($lang) < 2) $lang = "_ita"; $caps=false; $cappath=$imgdir.$gal."/captions$lang.dat"; if (file_exists($cappath)) { $stuff=file($cappath); foreach ($stuff as $line) { $cap=explode("|", rtrim($line)); $caps[$cap[0]]=$cap[1]; } } return $caps; } function nltobr($str){ return str_replace(array("\n", "\r"), array("
", ""), $str); } function brtonl($str){ return str_replace("
", "\n", $str); } function isBigger($path, $mode, $width, $height){ $img = getimagesize($path); if ($mode == "w"){ if ($img[0] > $width) return true; else return false; }else if ($mode == "h"){ if ($img[1] > $height) return true; else return false; }else if ($mode == "c"){ return true; }else if ($mode == "m"){ // landscape if ($img[0] > $img[1]){ if ($img[0] > $width) return true; else return false; // portrait }else{ if ($img[1] > $height) return true; else return false; } } } function getTemplate($tpl, $html) { $match="/<\!\-\-$tpl\-\->(.*?)<\!\-\-$tpl\-\->/s"; preg_match($match, $html, $tmp); return $tmp[1]; } function paging( $pages, $pagevar="page", $ppv=10, $first ="", $firsts ="", $prev ="", $prevs ="", $num ="{page}", $nums ="{page}", $sep =" | ", $more ="[...]", $next ="", $nexts ="", $last ="", $lasts ="") { /* $next ="  »»", $nexts ="  »»", $last =" »»»", $lasts =" »»»"*/ // $first ="««« ", // $firsts ="««« ", // $prev ="««  ", // $prevs ="««  ", // get URI parameters $getvars=$_SERVER['PHP_SELF']."?"; foreach ($_GET as $key => $val) { if ($key!=$pagevar) { if (isset($val) && $val!="") { $getvars.="$key=$val&"; } else { $getvars.="$key&"; } } } $page=(is_numeric($_GET[$pagevar])) ? $_GET[$pagevar] : 1; $page=($page>$pages) ? $pages : $page; $prevpage=($page>1) ? $page-1 : 1; $nextpage=($page < $pages) ? $page+1 : $pages; $paging=""; if ($pages>1) { // first $paging.=($page>1) ? str_replace("{url}", "$getvars$pagevar=1", $first) : $firsts; // prev $paging.=($page>1) ? str_replace("{url}", "$getvars$pagevar=$prevpage", $prev) : $prevs; // pages $ppvrange=ceil($page/$ppv); $start=($ppvrange-1)*$ppv; $end=($ppvrange-1)*$ppv+$ppv; $end=($end>$pages) ? $pages : $end; $paging.=($start>1) ? str_replace("{url}", "$getvars$pagevar=".($start-1), $more).$sep : ""; for ($i=1; $i<=$pages; $i++){ if ($i>$start && $i<= $end){ $paging.=($page==$i) ? str_replace("{page}", $i, $nums).(($i<$end) ? $sep : "") : str_replace(array("{url}", "{page}"), array("$getvars$pagevar=$i", $i), $num).(($i<$end) ? $sep : ""); } } $paging.=($end<$pages) ? $sep.str_replace("{url}", "$getvars$pagevar=".($end+1), $more) : "" ; // next $paging.=($page<$pages) ? str_replace("{url}", "$getvars$pagevar=$nextpage", $next) : $nexts; // last $paging.=($page<$pages) ? str_replace("{url}", "$getvars$pagevar=$pages", $last) : $lasts; } return $paging; } function execTemplate($html) { global $mgConf; ob_start(); eval("?>".$html."