Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 1 of 1
  1. #1
    Join Date
    Nov 2012
    Posts
    51
    Tokens
    313

    Default Can anybody help with this Issue?

    Hello guys!

    Im in the middle of a gallery and this script seems to scatter the images around like the metro (win8) look.
    Can anybody change it so it's inline / neat & tidy

    PHP Code:
            <?php

        error_reporting
    (E_ERROR);
    ?><?php
                    $filetypes  
    = array(".png"".PNG"".jpg"".JPG"".jpeg"".JPEG"".gif"".GIF");
                    
    $basedir    './galleries';
                    
    $currentdir '';
                    if(isset(
    $_GET['f']) ? $_GET['f'] : '')
                        {
                        
    $currentdir '/'.$_GET['f'].'/';
                        }

                    function 
    scandirSorted($path)
                        {
                        
    $sortedData  = array();
                        
    $data1       = array();
                        
    $data2       = array();
                        foreach(
    scandir($path) as $file)
                            {
                            if(!
    strstr($path'..'))
                                {
                                if(
    is_file($path.$file))
                                    {
                                    
    array_push($data2$file);
                                    }
                                else
                                    {
                                    
    array_push($data1$file);
                                    }
                                }
                            }
                        
    $sortedData array_merge($data1$data2);
                        return 
    $sortedData;
                        }

                    function 
    strpos_arr($haystack$needle)
                        {
                        if(!
    is_array($needle))
                            {
                            
    $needle = array($needle);
                            }
                        foreach(
    $needle as $what)
                            {
                            if((
    $pos strpos($haystack$what)) !== false)
                                {
                                return 
    $pos;
                                }
                            }
                        return 
    false;
                        }

                    function 
    addThumb($filename)
                        {
                        
    $filename    array_reverse(explode('.'$filename));
                        
    $filename[0] = 'smpgthumb.'.$filename[0];
                        
    $filename    implode('.'array_reverse($filename));
                        return 
    $filename;
                        }

                    if(
    is_dir($basedir.$currentdir))
                        {
                        
    $folder array_diff(scandirSorted($basedir.$currentdir), array('..''.''Thumbs.db''thumbs.db''.DS_Store'));
                        }

                    
    $navigation explode('/'$currentdir);
                    
    $navigation_elements count($navigation);
                    if(isset(
    $_GET['f']))
                        {
                        echo(
    '<div id="navigation"><a href="./">Home</a>');
                        }
                    foreach(
    $navigation as $element)
                        {
                        if(
    $element)
                            {
                            echo(
    ' / <a href="?f='.str_replace('//''/'str_replace(' ''%20'substr($currentdir0strpos($currentdir$element)+strlen($element)))).'#portofolio">'.$element.'</a>');
                            }
                        }
                    if(isset(
    $_GET['f']))
                        {
                        echo(
    '</div>');
                        }

                    echo(
    '<div class="container"> ');
                    foreach(
    $folder as $item)
                        {
                        if(!
    strstr(isset($_GET['f']), '..'))
                            {
                            if(!
    strstr($item'smpgthumb'))
                                {
                                if(
    strpos_arr($item$filetypes))
                                    {
                                    if(
    file_exists($basedir.$currentdir.'/'.addThumb($item)))
                                        {
                                        echo(
    ' <div class="span3 item"><figure class="figure-hover">
    <a href="'
    .str_replace('//''/'str_replace(' ''%20'$basedir.$currentdir.'/'.$item)).'" rel="friend"><img src="'.str_replace('//''/'str_replace(' ''%20'$basedir.$currentdir.'/'.addThumb($item))).'" class="swipebox" title="Image" alt="" /><div><span class="icon-hover icon-hover-zoom"></span></div>
            </a>
           </figure>
          </div> '
    );
                                        }
                                    else
                                        {
                                        echo(
    '<div class="span3 item"><figure class="figure-hover"><a href="'.str_replace('//''/'str_replace(' ''%20'$basedir.$currentdir.'/'.$item)).'" rel="friend"><img src="bin/thumb.php?file='.str_replace('//''/'str_replace(' ''%20'$basedir.$currentdir.'/'.$item)).'" class="swipebox" alt="" /></a>
           </figure>
          </div> '
    );
                                        }
                                    }
                                else
                                    {
                                    echo(
    ' <div class="span3 item"> <!-- 4 -->
        

         <h3><a href="?f='
    .str_replace('//''/'str_replace(' ''%20'$currentdir.'/'.$item)).'#portofolio">'.$item.'</a><br></h3>
        </div>
    '
    );
                                    }
                                }
                            }
                        }
                    echo(
    '</div>');
                
    ?>
    Last edited by Foxcom; 14-07-2013 at 05:00 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •