<?PHP
$uploadDir = $_SERVER['DOCUMENT_ROOT'] . '/upload/awb/' . $awb . '/';
if($_SERVER["REQUEST_METHOD"] == "POST"){
if(file_exists($uploadDir."/".$_POST["filename"])){
echo file_get_contents($uploadDir."/".$_POST["filename"]);
die;
}
}
?>
<script
src="http://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
<script>
$(function(){
$("ul").on("click","li",function(e){
$.ajax({
url: "<?=$_SERVER['PHP_SELF']?>",
type: 'POST',
data: {
filename:$(this).html()
}
}).done(function(data){
$("#out").html("<pre>"+data+"</pre>");
})
});
})
</script>
<ul>
<?PHP
$fileArray = array_diff(scandir($uploadDir, 1), array("inputScanning.json", "..", "."));
foreach ($fileArray as $filename)
echo "<li>$filename</li>";
?>
</ul>
<div id="out">
</div>
int[] firstMas = new int[0];
while (true) {
string userInput = Console.ReadLine();
if (userInput == "exit")
{
break;
}
else if (userInput == "sum")
{
int sum = 0;
for (int i = 0; i < firstMas.Length; i++)
sum += firstMas[i];
Console.WriteLine("Сумма введённых чисел равна " + sum);
}
else
{
int[] secondMas = new int[firstMas.Length + 1];
int number = Convert.ToInt32(userInput);
secondMas[secondMas.Length - 1] = number;
for (int i = 0; i < firstMas.Length; i++)
secondMas[i] = firstMas[i];
firstMas = secondMas;
Console.WriteLine("Длинна массива: " + firstMas.Length);
}
int[] arr = new int[0];
while (true){
string s = Console.ReadLine();
switch (s){
case "exit":
return;
case "sum":
Console.WriteLine(String.Format("Сумма введённых чисел = '{0}'", arr.Sum()));
break;
default:
int result;
if (int.TryParse(s, out result))
arr = arr.Concat(new int[] { result }).ToArray();
break;
}
}
$im = imagecreatefrompng('example.png');
$arr = [
['x' => 0, 'y' => 0, 'width' => 960, 'height' => 540],
['x' => 960, 'y' => 0, 'width' => 960, 'height' => 540],
['x' => 0, 'y' => 540, 'width' => 960, 'height' => 540],
['x' => 960, 'y' => 540, 'width' => 960, 'height' => 540],
];
foreach($arr as $k=>$v){
$im2 = imagecrop($im, $v);
if ($im2 !== FALSE) {
imagepng($im2, "example-cropped$k.png");
imagedestroy($im2);
}
}
imagedestroy($im);
var canvas = document.getElementById("myCanvas"),
context = canvas.getContext("2d");
var img = new Image();
var imgT = new Image();
var loaded = 0;
img.src = "https://img.rosbalt.ru/photobank/1/c/a/0/Z8X2VMCx.jpg";
imgT.src = "http://zabavnik.club/wp-content/uploads/background_html_1_16082041.jpg"
imgT.onload = img.onload = function() {
if(++loaded == 2)
draw();
};
function draw(){
context.drawImage(imgT, 300, 400,200,200);
context.drawImage(img, 0, 0);
console.log(canvas.toDataURL());
}