beatescheibel 4 lat temu
rodzic
commit
3d575c3dbe
3 zmienionych plików z 105 dodań i 9 usunięć
  1. 59 0
      app/static/css/style.css
  2. 42 6
      app/templates/show_image.html
  3. 4 3
      app/views.py

+ 59 - 0
app/static/css/style.css

@@ -1,3 +1,62 @@
 body {
   background-color: #f1f1f1;
 }
+.column {
+  float: left;
+  width: 50%;
+}
+/* Split the screen in half */
+.split {
+  height: 100%;
+  width: 50%;
+  position: fixed;
+  z-index: 1;
+  top: 0;
+  overflow-x: hidden;
+  padding-top: 20px;
+}
+
+/* Control the left side */
+.left {
+  left: 0;
+  background-color: white;
+}
+
+/* Control the right side */
+.right {
+  right: 0;
+  background-color: #f1f1f1;
+}
+.top {
+  height: 50vh;
+  background-color: #f1f1f1;
+}
+
+.bottom {
+  height: 50vh;
+  background-color: #f1f1f1;
+}
+/* If you want the content centered horizontally and vertically */
+.centered {
+  position: absolute;
+  top: 50%;
+  left: 40%;
+  transform: translate(-50%, -50%);
+  text-align: center;
+  margin: 10;
+}
+
+.header_centered {
+  position: absolute;
+  top: 8%;
+  left: 50%;
+  transform: translate(-50%, -50%);
+  text-align: center;
+  margin: 10;
+}
+
+/* Style the image inside the centered container, if needed */
+.centered img {
+  max-width: 140%;
+  /*border-radius: 50%;
+}

+ 42 - 6
app/templates/show_image.html

@@ -1,7 +1,43 @@
 <!doctype html>
-<title>Hello from Flask</title>
-{% if filename %}
-  <h1>some text <embed src="{{ url_for('send_file', filename=filename) }}" type="application/pdf">more text!</h1>
-{% else %}
-  <h1>no image for whatever reason</h1>
-{% endif %}
+<head>
+  <title>Hello from Flask</title>
+  <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}"/>
+</head>
+
+
+<div class="split left">
+<div class="header_centered">
+  <h1>Drawing</h1>
+</div>
+  <div class="centered">
+    {% if filename %}
+      <img src="{{ url_for('send_file', filename=filename) }}">
+    {% else %}
+      <h1>no image for whatever reason</h1>
+    {% endif %}
+
+  </div>
+</div>
+
+<div class="split right">
+  <div class="top">
+    <div style="text-indent:50px;">
+      <h1>Extracted Tolerances</h1>
+      <p>Maße: </p>
+    </div>
+  </div>
+
+
+  <div class="bottom">
+    <div style="text-indent:50px;">
+      <h1>Additional Requirements:</h1>
+    </div>
+    </div>
+</div>
+
+
+
+
+
+
+ <!--<img src="{{ url_for('send_file', filename=filename) }}" type="application/pdf" /-->

+ 4 - 3
app/views.py

@@ -5,7 +5,7 @@ from wand.image import Image as wandImage
 #https://medium.com/@emerico/convert-pdf-to-image-using-python-flask-2864fb655e01
 
 
-UPLOAD_FOLDER = '/home/bscheibel/Desktop/flask/uploads'
+UPLOAD_FOLDER = '/Users/beatescheibel/Desktop/flask/uploads'
 app.config["UPLOAD_FOLDER"] = UPLOAD_FOLDER
 ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif', 'PDF'])
 
@@ -26,8 +26,9 @@ def upload_file():
         if file and allowed_file(file.filename):
 
             filename = file.filename
-            image = wandImage(filename=filename)
-            image.save(os.path.join(app.config["UPLOAD_FOLDER"], filename))
+            #image = wandImage(filename=filename)
+            #image.save(os.path).join(app.config["UPLOAD_FOLDER"], filename)
+            file.save(os.path.join(app.config["UPLOAD_FOLDER"], filename))
             return redirect(url_for('uploaded_file', filename=filename))
     return '''
     <!doctype html>