Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.28 KB | None | 0 0
  1.  
  2.  
  3.   function galeria($album)
  4.   {
  5.   $ile = 3;
  6. if(!$album OR $album=="") $q = "SELECT distinct id, header, id_album FROM malta_gallery where id_album=(SELECT distinct id FROM `malta_albums` ORDER BY date DESC limit 1) ORDER BY RAND() limit 6;";
  7. if($album AND $album!="" AND $album!="all") $q = "SELECT * FROM malta_gallery where id_album=".$album." order by date asc";
  8. if($album=="all")
  9. {
  10. $ile = 6;
  11. $q = "SELECT m.id id_album, n.id id, n.header header, n.date date FROM malta_albums m LEFT JOIN malta_gallery n ON n.id_album = m.id GROUP BY m.id;";
  12. }
  13.  
  14.  $r = mysql_query($q);
  15.     if ( $r !== false && mysql_num_rows($r) > 0 )
  16.     {
  17.     $j = 0;
  18.       while ( $a = mysql_fetch_assoc($r) ) {
  19.         $j++;
  20.         $title = stripslashes($a['header']);
  21.     $date = $a['date'];
  22.     $file = $a['id'].".jpg";
  23.     $id_album = $a['id_album'];
  24.     $katalog = './albums/'.$id_album.'/';
  25.  
  26.         // if(!is_file( $katalog."mini/".$file))
  27.         //   {
  28.          //  $src= $katalog.$file;
  29.          //  $wydruk=$katalog."mini/".$file;
  30.          ///  $this->createThumb($src,$wydruk);
  31.          //  }
  32.  
  33.      if($album=="all")
  34.      {
  35.      $wyjscie .= ("<a title=\"".$title."\"  href=\"galeria,test,".$id_album."\"><img class='galeria_img' src=\"".$katalog."mini/".$file."\"  border=\"1\"></a>");
  36.      }
  37.     else
  38.     {
  39.     $wyjscie .= ("<a rel=\"gb_imageset[nowosci]\" title=\"".$title."\"  href=\"".$katalog.$file."\"><img class='galeria_img' src=\"".$katalog."mini/".$file."\"  border=\"1\"></a>");
  40.     }
  41.      if ($j%$ile==0)  { $wyjscie .= "<br>";}
  42.     }
  43.     }
  44.    
  45.     /*
  46.   $katalog = './albums/'.$album.'/';
  47.     $i = 1;
  48.     if ($handle = opendir($katalog))
  49.     {
  50.        while (false !== ($file = readdir($handle)))
  51.        {
  52.        if ($file != "." && $file != ".." && $file!="mini")
  53.            {
  54.            $tablica[$i] = $file;
  55.            $i++;
  56.         }
  57.     }
  58.     closedir($handle);
  59.     }
  60.    
  61.     for ($j=($ktora*20)-1;$j<(($ktora*20)+21);$j++)
  62.      {
  63.      $file = $tablica[$j];
  64.      if($tablica[$j]!=""){
  65.      if(!is_file( $katalog."mini/".$file))
  66.            {
  67.            $src= $katalog.$file;
  68.            $wydruk=$katalog."mini/".$file;
  69.            $this->createThumb($src,$wydruk);
  70.            }
  71.      $wyjscie .= ("<a rel=\"gb_imageset[nowosci]\" title=\"$j. $file\"  href=\"".$katalog.$file."\"><img class='galeria_img' src=\"".$katalog."mini/".$file."\"  border=\"1\"></a>");
  72.      if ($j%3==0)  { $wyjscie .= "<br>";}
  73.      }
  74.      }
  75.      */
  76.      
  77.   return $wyjscie;
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement