-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontroleCorteRaster.php
78 lines (70 loc) · 2.27 KB
/
controleCorteRaster.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
session_start();
error_reporting(E_ALL);
ini_set('display_errors','1');
require_once('classes/experimento.class.php');
require_once('classes/conexao.class.php');
$conexao = new Conexao;
$conn = $conexao->Conectar();
$Experimento = new Experimento();
$Experimento->conn = $conn;
$expid = $_REQUEST['expid'];
$op = $_REQUEST['op'];
if($op == 'L'){
$Experimento->limparCorteRaster($expid);
}
if($op == 'T'){
//trocar mapa selecionado
$png = $_REQUEST['png'];
$specie = $_REQUEST['specie'];
echo 'specie ' . $specie;
$hash = md5($expid);
$imageModelFolder = "temp/result/" . $hash;
$imageBasePath = '/var/www/html/rafael/modelr/temp/result/' . $hash;
if($specie == 'none'){
$sql = "select distinct(taxon) from modelr.occurrence where idexperiment=" . $expid . "and (idstatusoccurrence = 17 or idstatusoccurrence = 4)";
} else {
$sql = "select distinct(taxon) from modelr.occurrence where idexperiment=" . $expid . "and (idstatusoccurrence = 17 or idstatusoccurrence = 4) and taxon = '" . $specie . "'";
}
echo $sql;
/* $res = pg_exec($conn,$sql);
$results_array = array();
$conta_arquivos = 0;
while ($row = pg_fetch_array($res))
{
$log_directory = $imageModelFolder.'/'.$row['taxon'].'/present/ensemble';
if (is_dir($log_directory))
{
if ($handle = opendir($log_directory)){
//Notice the parentheses I added:
while(($file = readdir($handle)) !== FALSE)
{
$tamanho = strlen($file);
list ($arquivo, $ext) = preg_split ('[.]', $file);
{
if (strpos($file, $png))
{
//echo $ext.'<br>';
$ext = substr($file,-3);
if($ext == 'tif'){
$tiffPath = "'" . $imageBasePath . '/'. $row['taxon'].'/present/ensemble/' . $file . "'";
} else {
if(strpos($file, '_without_margins')){
$rasterPngPath = "'" . $imageBasePath . '/'. $row['taxon'].'/present/ensemble/' . $file . "'";
$returnRasterPngPath = $log_directory . "/" . $file;
} else {
$pngPath = "'" . $imageBasePath . '/'. $row['taxon'].'/present/ensemble/' . $file . "'";
}
}
}
}
}
closedir($handle);
}
}
}
//alterarPathImagemMapa
$Experimento->alterarPathImagemMapa($expid,$pngPath,$tiffPath, $rasterPngPath);
//echo retorna valores para javascript
echo $returnRasterPngPath; */
}