function getcorner($image, $cetvel) { $limit = 300; $minilimit = 10; $distance = 8; $stepbyspace = 20; /* B F +--------------------------+ A | | E | | | | | | | | | | C | | G +--------------------------+ D H */ /*(A)*/ $tl1 = findcolor($image, $cetvel[0][0], $cetvel[0][1], "x", "black", $limit); $temp[0] = $tl1[0]; $temp[1] = $tl1[1]; $A = array(); for ($k = 1; $k < 50; $k = $k + 1) { $x = $temp[0]; $y = $temp[1]; $temp = findcolor($image, $x - $distance, $y - $stepbyspace, "x", "black", $minilimit); if ($temp[0] == null && $temp[1] == null) { $temp[0] = $x; $temp[1] = $y; break; } else { $A[0][] = $temp[0]; $A[1][] = $temp[1]; setpixelone($image, $temp[0], $temp[1]); } } $Ax = $temp[0]; $Ay = $temp[1]; /*(B)*/ $tl2 = findcolor($image, $cetvel[2][0], $cetvel[2][1], "y", "black", $limit); $temp[0] = $tl2[0]; $temp[1] = $tl2[1]; $B = array(); for ($k = 1; $k < 50; $k = $k + 1) { $x = $temp[0]; $y = $temp[1]; $temp = findcolor($image, $x - $stepbyspace, $y - $distance, "y", "black", $minilimit); if ($temp[0] == null && $temp[1] == null) { $temp[0] = $x; $temp[1] = $y; break; } else { $B[0][] = $temp[0]; $B[1][] = $temp[1]; setpixeloneup($image, $temp[0], $temp[1]); } } $Bx = $temp[0]; $By = $temp[1]; /*(C)*/ $bl2 = findcolor($image, $cetvel[1][0], $cetvel[1][1], "x", "black", $limit); $temp[0] = $bl2[0]; $temp[1] = $bl2[1]; $C = array(); for ($k = 1; $k < 50; $k = $k + 1) { $x = $temp[0]; $y = $temp[1]; $temp = findcolor($image, $x - $distance, $y + $stepbyspace, "x", "black", $minilimit); if ($temp[0] == null && $temp[1] == null) { $temp[0] = $x; $temp[1] = $y; break; } else { $C[0][] = $temp[0]; $C[1][] = $temp[1]; setpixelone($image, $temp[0], $temp[1]); } } $Cx = $temp[0]; $Cy = $temp[1]; /*(D)*/ $bl1 = findcolor($image, $cetvel[4][0], $cetvel[4][1], "-y", "black", $limit); $temp[0] = $bl1[0]; $temp[1] = $bl1[1]; $D = array(); for ($k = 1; $k < 50; $k = $k + 1) { $x = $temp[0]; $y = $temp[1]; $temp = findcolor($image, $x - $stepbyspace, $y + $distance, "-y", "black", $minilimit); if ($temp[0] == null && $temp[1] == null) { $temp[0] = $x; $temp[1] = $y; break; } else { $D[0][] = $temp[0]; $D[1][] = $temp[1]; setpixeloneup($image, $temp[0], $temp[1]); } } $Dx = $temp[0]; $Dy = $temp[1]; /*(E)*/ $tr2 = findcolor($image, $cetvel[6][0], $cetvel[6][1], "-x", "black", $limit); $temp[0] = $tr2[0]; $temp[1] = $tr2[1]; $E = array(); for ($k = 1; $k < 50; $k = $k + 1) { $x = $temp[0]; $y = $temp[1]; $temp = findcolor($image, $x + $distance, $y - $stepbyspace, "-x", "black", $minilimit); if ($temp[0] == null && $temp[1] == null) { $temp[0] = $x; $temp[1] = $y; break; } else { $E[0][] = $temp[0]; $E[1][] = $temp[1]; setpixelone($image, $temp[0], $temp[1]); } } $Ex = $temp[0]; $Ey = $temp[1]; /*(F)*/ $tr1 = findcolor($image, $cetvel[3][0], $cetvel[3][1], "y", "black", $limit); $temp[0] = $tr1[0]; $temp[1] = $tr1[1]; $F = array(); for ($k = 1; $k < 50; $k = $k + 1) { $x = $temp[0]; $y = $temp[1]; $temp = findcolor($image, $x + $stepbyspace, $y - $distance, "y", "black", $minilimit); if ($temp[0] == null && $temp[1] == null) { $temp[0] = $x; $temp[1] = $y; break; } else { $F[0][] = $temp[0]; $F[1][] = $temp[1]; setpixeloneup($image, $temp[0], $temp[1]); } } $Fx = $temp[0]; $Fy = $temp[1]; /*(G)*/ $br1 = findcolor($image, $cetvel[7][0], $cetvel[7][1], "-x", "black", $limit); $temp[0] = $br1[0]; $temp[1] = $br1[1]; setpixelone($image, $temp[0], $temp[1]); $G = array(); for ($k = 1; $k < 50; $k = $k + 1) { $x = $temp[0]; $y = $temp[1]; $temp = findcolor($image, $x + $distance, $y + $stepbyspace, "-x", "black", $minilimit); if ($temp[0] == null && $temp[1] == null) { $temp[0] = $x; $temp[1] = $y; break; } else { $G[0][] = $temp[0]; $G[1][] = $temp[1]; setpixelone($image, $temp[0], $temp[1]); } } $Gx = $temp[0]; $Gy = $temp[1]; /*(H)*/ $br2 = findcolor($image, $cetvel[5][0], $cetvel[5][1], "-y", "black", $limit); $temp[0] = $br2[0]; $temp[1] = $br2[1]; $H = array(); for ($k = 10; $k < 300; $k = $k + 5) { $x = $temp[0]; $y = $temp[1]; $temp = findcolor($image, $x + $stepbyspace, $y + $distance, "-y", "black", $minilimit); if ($temp[0] == null && $temp[1] == null) { $temp[0] = $x; $temp[1] = $y; break; } else { $H[0][] = $temp[0]; $H[1][] = $temp[1]; setpixeloneup($image, $temp[0], $temp[1]); } } $Hx = $temp[0]; $Hy = $temp[1]; //Top left corner //$tl = findcolor($image, $tl1[0], $tl1[1], "-y", white, $limit); //$Xtl = $tl1[0]; //$Ytl = $tl2[1]; $Xtl = $Ax; $Ytl = $By; //Bottom left corner //$bl = findcolor($image, $bl1[0], $bl1[1], "-x", white, $limit); //$Xbl = $bl2[0]; //$Ybl = $bl1[1]; $Xbl = $Cx; $Ybl = $Dy; //Top right corner //$tr = findcolor($image,$tr1[0], $tr1[1], "x", white, $limit); //$Xtr = $tr2[0]; //$Ytr = $tr1[1]; $Xtr = $Ex; $Ytr = $Fy; //Bottom Right corner //$br = findcolor($image, $br1[0], $br1[1], "y", white, $limit); //$Xbr = $br1[0]; //$Ybr = $br2[1]; $Xbr = $Gx; $Ybr = $Hy; /*Orjinal Hesap Basla*/ $red = imagecolorallocate($image, 255, 0, 0); imagestring($image, 2, 10, 0, "Photoshop Skew Orjinal", $red); imagestring($image, 2, 10, 10, "ust Y = " . ($Ytl - $Ytr) . " px", $red); imagestring($image, 2, 10, 20, "sol X = " . ($Xtl - $Xbl) . " px", $red); imagestring($image, 2, 10, 30, "alt Y = " . ($Ybl - $Ybr) . " px", $red); imagestring($image, 2, 10, 40, "sag X = " . ($Xtr - $Xbr) . " px", $red); /*Orjinal Hesap Bitis*/ setpixelone($image, $Xtl, $Ytl); setpixelone($image, $Xtr, $Ytr); setpixelone($image, $Xbl, $Ybl); setpixelone($image, $Xbr, $Ybr); $GLOBALS['SpaceTop'] = $Ytl < $Ytr ? $Ytl : $Ytr; $GLOBALS['SpaceLeft'] = $Xtl < $Xtr ? $Xtl : $Xtr; $GLOBALS['SpaceBottom'] = ($Ybl > $Ybr ? $Ybl : $Ybr) - $GLOBALS['SpaceTop']; $GLOBALS['SpaceRight'] = ($Xbl > $Xbr ? $Xbl : $Xbr) - $GLOBALS['SpaceLeft']; //imagestring($image, 2, 200, 15, "Xtl = ".$Xtl.", Ytl = ".$Ytl.", Xbl = ".$Xbl.", Ybl = ".$Ybl.", Xtr = ".$Xtr.", Ytr = ".$Ytr.", Xbr = ".$Xbr.", Ybr = ".$Ybr, $red); //imagestring($image, 2, 200, 30, "GLOBALS Xtl = ".$GLOBALS['Xtl'].", Ytl = ".$GLOBALS['Ytl'].", Xbl = ".$GLOBALS['Xbl'].", Ybl = ".$GLOBALS['Ybl'].", Xtr = ".$GLOBALS['Xtr'].", Ytr = ".$GLOBALS['Ytr'].", Xbr = ".$GLOBALS['Xbr'].", Ybr = ".$GLOBALS['Ybr'], $red); $GLOBALS['V_tl_x'] = $Xtl - $GLOBALS['Xtl']; $GLOBALS['V_tl_y'] = $Ytl - $GLOBALS['Ytl']; $GLOBALS['V_tr_x'] = $Xtr - $GLOBALS['Xtr']; $GLOBALS['V_tr_y'] = $Ytr - $GLOBALS['Ytr']; $GLOBALS['V_bl_x'] = $Xbl - $GLOBALS['Xbl']; $GLOBALS['V_bl_y'] = $Ybl - $GLOBALS['Ybl']; $GLOBALS['V_br_x'] = $Xbr - $GLOBALS['Xbr']; $GLOBALS['V_br_y'] = $Ybr - $GLOBALS['Ybr']; //imagestring($image, 2, 200, 0, "V_tl_x = ".$GLOBALS['V_tl_x'].", V_tl_y = ".$GLOBALS['V_tl_y'].", V_tr_x = ".$GLOBALS['V_tr_x'].", V_tr_y = ".$GLOBALS['V_tr_y'].", V_bl_x = ".$GLOBALS['V_bl_x'].", V_bl_y = ".$GLOBALS['V_bl_y'].", V_br_x = ".$GLOBALS['V_br_x'].", V_br_y = ".$GLOBALS['V_br_y'], $red); }
$run = $res[0]; $MainId = $row['id']; $sel1 = "select date_complete from TransAct where Ticket_Main_id= '{$MainId}'"; $run2 = mysqli_query($con, $sel1); $res1 = mysqli_fetch_array($run2, MYSQLI_NUM); $run3 = $res1[0]; $sql = "select complete from Ticket_Main where id = '{$MainId}'"; $query = mysqli_query($con, $sql); $ar = mysqli_fetch_array($query); echo "<td style= 'color: " . findcolor($ar) . "' class = 'tab'><a href = 'http://quantum-co.com/Internship_Program/Edward/Project_5/Resources/Ticket.php?Ticket={$MainId}'>" . $row['priority'] . "</a></td>"; echo "<td style= 'color: " . findcolor($ar) . "' class = 'tab'><a href = 'http://quantum-co.com/Internship_Program/Edward/Project_5/Resources/Ticket.php?Ticket={$MainId}'>" . $run . "</a></td>"; echo "<td style= 'color: " . findcolor($ar) . "' class = 'tab' style = 'word-break:keep-all;width: 262px;'><a href = 'http://quantum-co.com/Internship_Program/Edward/Project_5/Resources/Ticket.php?Ticket={$MainId}'>" . $row['subject'] . "</a></td>"; echo "<td style= 'color: " . findcolor($ar) . "' class = 'tab'><a href = 'http://quantum-co.com/Internship_Program/Edward/Project_5/Resources/Ticket.php?Ticket={$MainId}'>" . $row['author'] . "</a></td>"; echo "<td style= 'color: " . findcolor($ar) . "' class = 'tab'><a href = 'http://quantum-co.com/Internship_Program/Edward/Project_5/Resources/Ticket.php?Ticket={$MainId}'>" . $row['date'] . "</a></td>"; echo "<td style= 'color: " . findcolor($ar) . "' class = 'tab' ><a href = 'http://quantum-co.com/Internship_Program/Edward/Project_5/Resources/Ticket.php?Ticket={$MainId}'>" . $row['updated'] . "</a></td>"; echo "<td style= 'color: " . findcolor($ar) . "' class = 'tab'><a href = 'http://quantum-co.com/Internship_Program/Edward/Project_5/Resources/Ticket.php?Ticket={$MainId}'>" . $row['date_comp'] . "</a></td>"; echo '</tr>'; $i = $i + 1; } echo "</table>"; echo "</div>"; function findcolor($ar) { if ($ar['complete'] == '0') { return "red"; } if ($ar['complete'] == '1') { return "green"; } if ($ar['complete'] == '2') { return "orange";