[BETA] TS gallery mod -- get images from TS gallery

[BETA] TS gallery mod -- get images from TS gallery

Postby Admin on Tue Apr 08, 2008 12:24 am

Updated : some order choose done.
You can call the function in the page that you want in this way :
With get_gl_images(5); you can get 5 images
With get_gl_images(4); you can get 4 images and so on
Default image are 3 and you can get them with get_gl_images();

Step one :
Add php function where you want :
Code: Select all
/**
*
* @package TS Gallery mod by futuresquare.net
* @fiorefrank Exp $
* @license Affero GNU Public License
*
*/

function get_gl_images($gl_imm_limit_def=3 , $ordine="random")
{

switch ($ordine)
         {
            case "random":
               $or_by = "RAND()";
            break;

            case "most_view":
               $or_by = "pic_views";
            break;

            case "time":
               $or_by = "pic_time";
            break;
         }
global $db , $template , $phpbb_root_path , $phpEx;

// for change images number from url
if(@$_GET["gl_limit"] != "") $gl_imm_limit = $_GET["gl_limit"] ;
   else $gl_imm_limit = $gl_imm_limit_def ;



   $sql = 'SELECT a.* , b.*
               FROM ' . GALLERY_PICS_TABLE . " AS a
      LEFT JOIN  " . GALLERY_ALBUMS_TABLE . " AS b ON (b.album_id = a.pic_album_id) 
      WHERE b.album_password = '' ORDER BY $or_by DESC LIMIT $gl_imm_limit ";
      $result = $db->sql_query($sql);
      
      

      while ($row = $db->sql_fetchrow($result))
      {   //if ($row['rate_point'] != "" ) $punteggio = $row['rate_point']; else $punteggio = "-";
         $sql_pic = 'SELECT rate_point            
               FROM ' . GALLERY_RATE_TABLE . '
               WHERE rate_pic_id = ' . $row['pic_id'] ;
         $result_pic = $db->sql_query($sql_pic);
         
         $rate = 0; $n=0;
         while ($row_pic = $db->sql_fetchrow($result_pic)){
            $rate = $rate + $row_pic['rate_point'];
            $n++;
         
         }
         $flag = false; // di default è spento il flag per la visualizzazione delle stelle

         if ($n)   {
            $flag = true;
            $med = $rate / (2 * $n) ;
            $count = 1;
            $intero = (int) $med ;
            $non_int =  $med - $intero;
            $totale = "" ;
            while($count <= 5)
            {
            if ( ($count - $intero) > 0 )
               {
               if ( ($count - $intero) == 1 && $non_int != 0) $imm_link = "includes/arcade/images/star3.gif";
               else $imm_link = "includes/arcade/images/star2.gif";
               }
            else    {
               $imm_link = "includes/arcade/images/star1.gif";
               }

            //creo le immagini (stelline) con tag html pronte per l'utilizzo
            $totale = $totale . "<img src=". $imm_link . "  />" ;
            $count ++ ;
            }
         }
         $template->assign_block_vars("imm_galleria", array(
         'VIEW'      => "./gallery/views.php?start=0", //Image points
         //'U_LINK'      => $phpbb_root_path. "gallery/upload/cache/small_" . $row['pic_physical_filename'],
         'U_LINK'   => $phpbb_root_path. "gallery/pic.{$phpEx}?mode=small&amp;pic_id=". $row['pic_id'] ,
         'BY'      => $row['pic_username'],
         'FLAG_STAR'     => $flag,
         'RATE_FLAG'   => true ,  ////// da definire
         'STAR'       => $totale,
         ));
      }
      $db->sql_freeresult($result);
}


Step two :
Call it with get_gl_images(); or get_gl_images(5); or ....
Default is random view , for coose something other use
get_gl_images(3 , "most_view") ; <--- most view pics
get_gl_images(3 , "time"); <-- recent pics
Step two note: if you add the step one code into xyz.php file you have to add include("../yourdir/xyz.php"); before use get_gl_images();



Step three :
Into template you have to add this :

Prosilver theme :
Code: Select all
<br>
<div class="forabg" align="center">
   <div class="inner">
      <span class="corners-top"><span></span></span>
         <h4 class="titlemenu" style="color:#FFFF00"><em>--- From Albums</em>> ---</h4>
   <div class="navbar" style="font-size:12px;">
   <br />   


   <table ><TR>
   <!-- BEGIN imm_galleria -->
   <TD class="gallery-pics-td">
   <div >
      <div align="center" >
      <a href="{imm_galleria.VIEW}"> <img style="float:left" src="{imm_galleria.U_LINK}" alt="{imm_galleria.TITOLO}" /></a>
      </div>
      <hr />
      <!-- IF imm_galleria.FLAG_STAR -->
         <div align="center">{imm_galleria.STAR}</div>
      <!-- ENDIF -->
      <div>by {imm_galleria.BY} </div>
         
   </div>
   </TD>
   <!-- END imm_galleria -->
   </TR></table>

   <a class="icon-register" href="http://www.futuresquare.net">By futuresquare.net</a>
   </div>
      <span class="corners-bottom"><span></span></span>
   </div>
</div>

Subsilver theme
Code: Select all
<br>
<div class="forabg" align="center">
   <div class="inner">
      <span class="corners-top"><span></span></span>
   <div class="navbar" style="font-size:12px;">
    <table class="tablebg" width="100%" cellspacing="{$CA_SPACING}">
      {$CA_CAP_START}<a href="./gallery/menu.php">--- From Albums ---</a>{$CA_CAP_END}
      <tr>
        <td class="row1" width="100%"><span class="genmed">
    </span><table width="100%" align="center" >
      <tr>
       <!-- BEGIN imm_galleria -->
       <td align="center" width="{S_COL_WIDTH}" class="row1"> <span class="genmed">
          <p align="center"><a href="{imm_galleria.VIEW}"> <img src="{imm_galleria.U_LINK}" alt="{imm_galleria.TITOLO}" align="middle" vspace="10" /></a><br />
              </div>
          </p>           
          <p>&nbsp;</p>
          <!-- IF imm_galleria.FLAG_STAR -->
               <div align="center">
               <hr width="200" />
               <p>{imm_galleria.STAR}</p>
             </div>
          <!-- ENDIF -->
          <div>by {imm_galleria.BY} </div>         
       </div>   </TD>
       <!-- END imm_galleria -->
      </tr></table>
    <br />    </td>
      </tr>
      </table>

   <a class="icon-register" href="http://www.futuresquare.net">By futuresquare.net</a>
   </div>
      <span class="corners-bottom"><span></span></span>
   </div>
</div>


Some suggestions, questions or requests are welcome!
Online demo is here : http://www.futuresquare.net
For help maybe i'm here http://www.futuresquare.net/chat/

New columns : Title - By - Views - Comments (with link) --> Done here

Number of comments --> done here

Next features
- Other choose order
- get images from a specific topic or forum
- flash nice sistem to view (i get the file from a user)
- Vertical align
- images gallery work with AJAX chat
we don't see things like they are but we see them like we are
User avatar
Admin
Site Admin
Site Admin
 
Posts: 113
Joined: Wed Mar 05, 2008 6:31 am
Location: Internet
Highscores: 6

google adsense
Google
 

Re: TS gallery mod -- get images from TS gallery

Postby Zuritz on Tue Apr 08, 2008 1:56 pm

Thanks, but can you give me an examlpe?

Ok, if I:

Step one:
Add this in my ./phpBB3/index.php (ok with this?)

Step two:
I don't understand this??? Where add this?

Step three:
I add this in my ./styles/subsilver2/template/index_body.html (ok with this?)

Please help.
Thanks
Zuritz
Level 1
Level 1
 
Posts: 17
Joined: Tue Apr 08, 2008 1:45 pm

Re: TS gallery mod -- get images from TS gallery

Postby Admin on Tue Apr 08, 2008 2:49 pm

Hi,
Step one is ok ( but you can also add it in a different file and include it with include() )

however step 2 is, in your case, also in phpBB3/index.php, after step one

Step 3 is ok.

For some help just ask :D
maybe i'm in chat
we don't see things like they are but we see them like we are
User avatar
Admin
Site Admin
Site Admin
 
Posts: 113
Joined: Wed Mar 05, 2008 6:31 am
Location: Internet
Highscores: 6

Re: TS gallery mod -- get images from TS gallery

Postby Zuritz on Tue Apr 08, 2008 5:14 pm

Hi,

Thank you!!! :D

I tryed in step two get_gl_images() many times with no luck, until I tryed get_gl_images(); and it work successfully :D

It is nice in prosilver, but not so nice in subsilver 2, (se attachment)

Can I use random or recent images?

Thanks for your help :D
Attachments
1.jpg
1.jpg (18.1 KB) Viewed 138299 times
Zuritz
Level 1
Level 1
 
Posts: 17
Joined: Tue Apr 08, 2008 1:45 pm

Re: TS gallery mod -- get images from TS gallery

Postby Admin on Tue Apr 08, 2008 5:22 pm

yeah, that problem is becouse there are stars like in my portale

you can add stars in this folder

includes/arcade/images/

and the stars have to be named :

star1.gif for full star
star2.gif for empty star
star3.gif for half star

of course you can add no stars but other little pics :D

however if you don't want stars just tell me and i'll rebuild the code
Try our live chat at Futuresquare.net live chat ;)
we don't see things like they are but we see them like we are
User avatar
Admin
Site Admin
Site Admin
 
Posts: 113
Joined: Wed Mar 05, 2008 6:31 am
Location: Internet
Highscores: 6

Re: TS gallery mod -- get images from TS gallery

Postby Zuritz on Tue Apr 08, 2008 5:51 pm

Thank you,

I like recent image more, but your stars are nice too :D

If you have some time in future to show med your code for recent images?

I am not so fast, and writing slow in english yet, but I will try your chat later :oops:

Thanks for your good work!!! :D
Zuritz
Level 1
Level 1
 
Posts: 17
Joined: Tue Apr 08, 2008 1:45 pm

google adsense
Google
 

Re: TS gallery mod -- get images from TS gallery

Postby Admin on Tue Apr 08, 2008 6:13 pm

thanks :D
the next feature is choose order (top rated, most views , recent, only from one gallery, ...)
see you
we don't see things like they are but we see them like we are
User avatar
Admin
Site Admin
Site Admin
 
Posts: 113
Joined: Wed Mar 05, 2008 6:31 am
Location: Internet
Highscores: 6

Re: TS gallery mod -- get images from TS gallery

Postby Zuritz on Wed Apr 09, 2008 1:56 pm

Hello :D

I meand this in my earlier post:

In 2.jpg I use subsilver2 and 1.jpg using prosilver. Not so nice in subsilver2. I have tryed edit your html code, with no luck yet. Maybe you only support prosilver?

Thanks :D
Attachments
1.jpg
prosilver
1.jpg (35.6 KB) Viewed 138227 times
2.jpg
subsilver2
2.jpg (27.73 KB) Viewed 138221 times
Zuritz
Level 1
Level 1
 
Posts: 17
Joined: Tue Apr 08, 2008 1:45 pm

Re: TS gallery mod -- get images from TS gallery

Postby Admin on Wed Apr 09, 2008 9:03 pm

just try this and tell me how it works :

Code: Select all
<table ><TR>
       <!-- BEGIN imm_galleria -->
       <TD align="center" valign="top" width="20%">
       <div >
          <div align="center" >
          <a href="{imm_galleria.VIEW}"> <img style="float:left" src="{imm_galleria.U_LINK}" alt="{imm_galleria.TITOLO}" /></a>
          </div>
          <hr />
          <!-- IF imm_galleria.FLAG_STAR -->
             <div align="center">{imm_galleria.STAR}</div>
          <!-- ENDIF -->
          <div>by {imm_galleria.BY} </div>
             
       </div>
       </TD>
       <!-- END imm_galleria -->
       </TR></table>


see you ;)
we don't see things like they are but we see them like we are
User avatar
Admin
Site Admin
Site Admin
 
Posts: 113
Joined: Wed Mar 05, 2008 6:31 am
Location: Internet
Highscores: 6

Re: TS gallery mod -- get images from TS gallery

Postby Zuritz on Wed Apr 09, 2008 10:03 pm

Hi :D

Thanks for your help, but same things happend. I use etech, a subsilver2 based template/styles. If I fix this code to:

Code: Select all
<table class="tablebg" width="100%" cellspacing="{$CA_SPACING}">
  {$CA_CAP_START}<a href="./gallery/menu.php">--- From Albums ---</a>{$CA_CAP_END}
  <tr>
    <td class="row1" width="100%"><span class="genmed">
</span><table width="100%" align="center" >
  <tr>
   <!-- BEGIN imm_galleria -->
   <td align="center" width="{S_COL_WIDTH}" class="row1"> <span class="genmed">
      <p align="center"><a href="{imm_galleria.VIEW}"> <img src="{imm_galleria.U_LINK}" alt="{imm_galleria.TITOLO}" align="middle" vspace="10" /></a><br />
          </div>
      </p>           
      <p>&nbsp;</p>
      <!-- IF imm_galleria.FLAG_STAR -->
           <div align="center">
           <hr width="200" />
           <p>{imm_galleria.STAR}</p>
         </div>
      <!-- ENDIF -->
      <div>by {imm_galleria.BY} </div>         
   </div>   </TD>
   <!-- END imm_galleria -->
  </tr></table>
<br />    </td>
  </tr>
  </table>


It works good now. I am not very good on html, and maybe thing can be done another way?
Look here: :D http://home.online.no/~heldige/3.jpg

Thanks for your very good help :D
Zuritz
Level 1
Level 1
 
Posts: 17
Joined: Tue Apr 08, 2008 1:45 pm

Next

Return to MOD Reviews

Who is online

Users browsing this forum: No registered users and 0 guests

cron