/* 230407 follow ups: started working on STL. handler in place, not quite working yet, not sure. set random hex color painting on stl. need to test. 230408 updates: modified 2d sizing. aspect ratio is not calculated and the a frame entity size values are more accurate to image, not just statuc placeholders causingj images to squish. new function to handle this, calculateAspect() link is placed under the scene. we will eventually make the scene slightly less than viewport height, to reveal a scroll for more layout. this works */ date_default_timezone_set('America/Los_Angeles'); include("../meta/mysql/mysqli_connect_wigglefish2016.php"); // PAGE KEYS $key_table = "activity"; $key_type = "#InstantNodal project"; $nodalLink = null; function calculateAspect($file,$dimension) { // 230408 this is a 2D asset. detect image proportion and customize the width and height.based on https://stackoverflow.com/questions/36642512/get-image-aspect-ratio // the simpler approach from https://www.omnicalculator.com/other/image-ratio used here /* Our aspect ratio calculator for images uses the following ratio converter formulas: H1/W1 = H2/W2 W2 = H2 * W1/H1 W2 = 16 * 1080/1920 W2 = 9 */ list($imageWidth, $imageHeight, $type, $attr) = getimagesize("assets/$file"); $thisEntityHeight = 2 ; $thisEntityWidth = $thisEntityHeight * ($imageWidth / $imageHeight); if ($dimension == "width") { return $thisEntityWidth; } if ($dimension == "height") { return $thisEntityHeight; } } function generateHexColor() { // https://css-tricks.com/snippets/php/random-hex-color/ $rand = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'); $color = '#'.$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)]; return $color; } function getVisitorIP() { if (!empty($_SERVER['HTTP_CLIENT_IP'])) //check ip from share internet { $ip=$_SERVER['HTTP_CLIENT_IP']; } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //to check ip is pass from proxy { $ip=$_SERVER['HTTP_X_FORWARDED_FOR']; } else { $ip=$_SERVER['REMOTE_ADDR']; } return $ip; } function trackView($thisID) { $mysqli = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); // assign all states based on session $thisTarget = "activity_history"; $thisType = "Nodal View"; $thisCreateAuthor = "WebAR App"; // process all record inputs that cannot be null $appID = "31337"; // no app id means the content is universal $thisStatus = 1000; // assume status 1000, not open to all $thisIP = getVisitorIP(); // escape certain incoming variables registered above // name should be figured out based on the incoming key variable. but we will hard code it for now $thisName = "InstantNodals WebAR App Usage - $thisIP"; $insert = mysqli_query($mysqli," INSERT INTO $thisTarget VALUES ( '$thisID', '$appID', '$thisStatus', '$thisType', '$thisName', now(), '$thisCreateAuthor', now(), '$thisCreateAuthor' ) "); } function generateActivityDetail($id,$table,$type,$detail) { $mysqli = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); $query = " SELECT $detail FROM $table WHERE id = '$id' AND type = '$type' "; $rows=mysqli_query($mysqli,$query); $result=mysqli_num_rows($rows); // do the results here if ($result) { while ($row = mysqli_fetch_array($rows,MYSQLI_NUM)) { $thisDetail = $row[0]; } } return $thisDetail; } if (isset($_POST['action'])) { if ($_POST['action']="addNode") { // handle incoming data $mysqli = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); // assign all states based on session $thisTarget = $key_table; $thisType = $key_type; $thisCreateAuthor = $_POST['nodeEmail']; // process all record inputs that cannot be null $appID = "1958"; // no app id means the content is universal $thisStatus = 1000; // assume status 1000, not open to all //$thisIP = getVisitorIP(); // escape certain incoming variables registered above // name should be figured out based on the incoming key variable. but we will hard code it for now $thisName = "#InstantNodal project by $thisCreateAuthor"; $insert = mysqli_query($mysqli," INSERT INTO $thisTarget VALUES ( null, '$appID', '$thisStatus', '$thisType', '$thisName', now(), '$thisCreateAuthor', now(), '$thisCreateAuthor' ) "); // get the id that was just created $thisID = $mysqli->insert_id; //echo "
Added $thisName as $thisID.
";
$aframeEntity = "
";
$aframeEntity = "
";
$aframeEntity = "
";
$aframeEntity = "