file upload

This commit is contained in:
Walter Hupfeld 2024-03-12 20:34:11 +01:00
parent d6312dc965
commit 882fb90145

View File

@ -1,5 +1,5 @@
<?php
/*******************************
/* ******************************
* Ideenmelder
* Autor: Walter Hupfeld, Hamm
* E-Mail: info@hupfeld-software.de
@ -16,7 +16,7 @@
$strDistrict=$_SESSION['district'];
}
else {
header("Location: start.php");
header("Location: start.php");
}
require("config.php");
if ($strDistrict=="unkown") { header("Location: start.php");}
@ -33,10 +33,9 @@
$result->bindParam(":district",$strDistrict);
$result->execute();
/* Für die Auswertung nur bestimmte Kategorien anzeigen
$numDefect="(6,8,21)";
$strSQL="SELECT loc.*,f.filename FROM location loc LEFT JOIN files f ON loc.id=f.loc_id WHERE defect in ".$numDefect;
$numDefect="(6,8,21)";
$strSQL="SELECT loc.*,f.filename FROM location loc LEFT JOIN files f ON loc.id=f.loc_id WHERE defect in ".$numDefect;
*/
$arrMarker = array();
$arrDescription = array();
$id=0;
@ -68,8 +67,6 @@
<meta name="author" content="Walter Hupfeld, info@hupfeld-software.de">
<meta name="description" content="Georeferenzieter Ideenmelder">
<script src="js/jquery.min.js"></script>
<script src="js/leaflet.js"></script>
<script src="js/leaflet.ajax.js"></script>
@ -88,7 +85,6 @@
</head>
<body>
<!-- Navbar -->
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
<a class="navbar-brand" href="#"><?= $strTitle ?> <?=$strDistrictTitle?></a>
@ -116,8 +112,6 @@
</form>
<?php endif; ?>
</ul>
<div>
<ul class="navbar-nav mr-auto right">
<li class="nav-item">
@ -158,7 +152,6 @@
<main role="main" class="col-md-9 ml-sm-auto col-lg-10 px-1">
<div id="mapid"></div>
</main>
</div>
<!-- row -->
</div>
@ -458,6 +451,7 @@
var _URL = window.URL || window.webkitURL;
if ((file = this.files[0])) {
var file = this.files[0];
console.log(file["size"]);
var fileType = file["type"];
var validImageTypes = ["image/gif", "image/jpeg", "image/png"];
if ($.inArray(fileType, validImageTypes) < 0) {
@ -465,18 +459,18 @@
alert("Keine Bilddatei, nur gif,jpeg,png erlaubt.")
$("#photo").val("");
}
//if (file["size"]>1000000) { alert("Bilder sollten maximal 1 MB groß sein");}
if (image_ok) {
img = new Image();
var objectUrl = _URL.createObjectURL(file);
img.onload = function () {
image_ok = (this.width<2000 && this.height<2000 && this.width>100 && this.height>100);
console.log("Breite:" + this.width + " Höhe: " + this.height);
console.log(this);
image_ok = (this.width<4000 && this.height<4000 && this.width>100 && this.height>100);
//console.log("Breite:" + this.width + " Höhe: " + this.height);
/*
if (!image_ok) {
alert("Bilder dürfen maximal 2000 x 2000 Pixel groß sein.\n"
+"Breite:" + this.width + " Höhe: " + this.height)
}
}*/
};
img.src = objectUrl;
}