<?php 
error_reporting(0);
ini_set(¡Èdisplay_errors¡É, 0 );


?>
<!DOCTYPE html>

<html>
    <head><meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
        <title>Immobile Business 360 Virtual</title>
        <meta name="viewport" content="width=device-width, initial-scale=1">
		<meta name="description" content="360 Virtual Tour PHP"/>
        
        <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,300' rel='stylesheet' type='text/css'>
         <link href="css/owl.carousel.css" media="all" rel="stylesheet" type="text/css" />
         <link href="css/style.css" media="all" rel="stylesheet" type="text/css" />
         <link href="css/animate.css" media="all" rel="stylesheet" type="text/css" />
         <link href="css/loaders.css" media="all" rel="stylesheet" type="text/css" />
         <link href="css/font-awesome.min.css" media="all" rel="stylesheet" type="text/css" />
         <script src="js/jquery-1.12.2.min.js"></script>
         <script>
            /* If you want to stop starting auto scroll panorama  just change 'false' value below. */
            var autoScrol = true;
         </script>
    </head>
    <body>
        <div class="panorama-body">

            <div id="panorama">
			<div id="pan-canvas"></div>
			<div class="panos-menu">
               <div id="panos-list">
                    <ul id="menu-show">
                       <div class="menu-centered">
                           <div class="owl-carousel">
<?php
  include "../conexao.php";
  $idempreendimento  = $_GET["idempreendimento"];
  $result = mysqli_query($db, "SELECT * FROM tour_empreendimento where empreendimento_id = '$idempreendimento' order by ordem asc");
  
  $num_rows = mysqli_num_rows($result);


    $panCount = 1;
        
      while ($buscar_amigo = mysqli_fetch_assoc($result)) {//--verifica se sÃ£o amigos
            
            $itName            = $buscar_amigo["titulo_tour"];
            $filename          = $buscar_amigo["img_tour"];
            $filename2         = $buscar_amigo["img_tour"];

    
   
$filename = 'fotos/'.$idempreendimento.'/'.$filename;

    $width = 300;
    $height = 300;

    list($width_orig, $height_orig) = getimagesize($filename);
    $ratio_orig = $width_orig/$height_orig;

    if ($width/$height > $ratio_orig) {
       $width = $height*$ratio_orig;
    } 
    else {
       $height = $width/$ratio_orig;
    }


    $image_p = imagecreatetruecolor($width, $height);
    $image = imagecreatefromjpeg($filename);
    imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);

    if (!file_exists('small')) {
    mkdir('small', 0777, true);
}
    imagejpeg($image_p, "small/".$idempreendimento."/".$filename2, 90);


?>

<div data-hash="<?php echo $panCount;  ?>">
<li data-pan-id="<?php  echo $panCount;  ?>" data-pan-desc="<?php echo $itName; ?>" id= "pan-menu-<?php  echo $panCount;  ?>" class="pan-menu">
                               
                                <a class="pan-menu-item"  id="pan-image-<?php echo $panCount; ?>" data-pan-href="<?php echo $filename ?>" href="#<?php echo $panCount; ?>">
                                <img class="pan-slide-thumb" src="fotos/<?php echo $idempreendimento ?>/<?php echo $filename2 ?>">
                                <?php 
                                if(!empty($itName))
                                    echo $itName;
                                    ?></a>
                            </li></div>
                            <?php
                            $panCount = $panCount + 1;

                            } // Exibe o titulo da foto aqui em cima ...
                        ?>
                            </div>
                        </div>
                    </ul>
                   
                    <div class="pan-description"></div>
                    <i id="rotate" class="menu-button fa fa-chevron-down" aria-hidden="true"></i>
                    <span id="fullScreenMode" >
                       <span id="fullscreenPan"><img id="fullscreen-icon" src="img/fullscreen.png"></span>
                    </span>
                    <div id="loader-pan" class="fadeInLeft animated">
                    <div class="wrapper">
                        <div class="cssload-loader"></div>
                    </div>
                </div>
                </div>
			</div>
			<?php
		
		?>
               <div id="loader-wrapper">
                    <div class="first-wrapper">
                    <div class="first-cssload-loader"></div>
                </div>
                    <div class="loader-section section-left"></div>
                    <div class="loader-section section-right"></div>
                </div>
            </div>
            <div class="top_buttons"></div>

            <div class="keys">
              <div class="zoom_conrol">
                    <span id="zoom_in"><img class="zoom" src="img/zoom-in.png"></span>
                    <span id="zoom_out"><img class="zoom" src="img/zoom-out.png"></span>
                </div>
               
                <div class="control-key">
                    <img class="control_keys" id="left_key" src="img/left_button.PNG">
                    <img class="control_keys" id="right_key" src="img/right_button.PNG">
                    <img class="control_keys" id="up_key" src="img/up_button.PNG">
                    <img class="control_keys" id="down_key" src="img/down_button.PNG">
                    <img class="control_keys" id="elipse_key" src="img/elipse.PNG">
                </div>
            </div> 

            <script src="js/three.min.js"></script>
            <script src="js/jquery.fullscreen.js"></script>
            <script src="js/DeviceOrientationControls.js"></script>
            <script src="js/mousehold.js"></script>
            <script src="js/owl.carousel.min.js"></script>
            <script src="js/mousetrap.min.js"></script>
            <script src="js/jquery.touch.js"></script>
            <script src="js/360.virtual.tour.js"></script>  
        </div>
            <input id="source-url" type="hidden" value="">
    </body>
</html>
