├── .idea ├── inspectionProfiles │ ├── Project_Default.xml │ └── profiles_settings.xml ├── misc.xml ├── modules.xml ├── photo-gallery-python-flask.iml └── workspace.xml ├── __pycache__ └── definition.cpython-36.pyc ├── data └── credentials.json ├── definition.py ├── main.py ├── modules ├── Gallery.py ├── Login.py ├── Photos.py └── __pycache__ │ ├── Gallery.cpython-36.pyc │ ├── Login.cpython-36.pyc │ └── Photos.cpython-36.pyc ├── static ├── css │ ├── ie10.css │ ├── signin.css │ └── thumbnail-gallery.css ├── images │ ├── default-thumbnail.jpg │ └── loader.gif ├── js │ └── myscript.js └── photos │ ├── Party │ ├── IMG_20160812_171153.jpg │ ├── IMG_20160829_204027.jpg │ └── Thumbs.db │ └── cars │ └── IMG_20160920_073221.jpg └── templates ├── _layout.html ├── gallery.html ├── index.html └── photos.html /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | Buildout 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Unnamed 25 | 26 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/photo-gallery-python-flask.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 11 | -------------------------------------------------------------------------------- /.idea/workspace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 12 | 13 | 15 | 16 | 17 | 18 | 19 | 20 | 25 | 26 | 27 | 28 | json 29 | loader 30 | loader.gif 31 | delete 32 | deleteGallerybtn 33 | delete_gallery_photos 34 | deletePhotobtn 35 | 36 | 37 | 38 | 54 | 55 | 56 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 83 | 84 | 87 | 88 | 89 | 90 | 93 | 94 | 97 | 98 | 101 | 102 | 103 | 104 | 107 | 108 | 111 | 112 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 144 | 145 | 161 | 162 | 178 | 179 | 190 | 191 | 209 | 210 | 228 | 229 | 249 | 250 | 271 | 272 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 309 | 310 | 311 | 312 | 1489353885465 313 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 345 | 346 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | -------------------------------------------------------------------------------- /__pycache__/definition.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sumairz/photo-gallery-python-flask/8ffa891c6b81772cdc063a0eca85dcda502b6a53/__pycache__/definition.cpython-36.pyc -------------------------------------------------------------------------------- /data/credentials.json: -------------------------------------------------------------------------------- 1 | { 2 | "credentials": { 3 | 4 | "admin": { 5 | "user":"admin", 6 | "password": "root", 7 | "type": "admin" 8 | }, 9 | 10 | "normal": { 11 | "user":"user", 12 | "password": "user", 13 | "type": "normal" 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /definition.py: -------------------------------------------------------------------------------- 1 | # Credential File link 2 | CREDENTIALS_FILE = "data/credentials.json" 3 | 4 | # Folder Paths 5 | Gallery_Folder = "static/photos/" -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | from flask import Flask 2 | from flask import sessions 3 | from flask import request 4 | from flask import render_template 5 | from flask import redirect, url_for 6 | from werkzeug.utils import secure_filename 7 | import json 8 | import os 9 | from modules.Login import Login 10 | from modules.Gallery import Gallery 11 | from modules.Photos import Photos 12 | from definition import * 13 | 14 | app = Flask(__name__) 15 | ALLOWED_EXTENSIONS = set(['jpg', 'jpeg']) 16 | session = {} 17 | 18 | ''' 19 | for int routes 20 | @app.route('/') 21 | def func(id): 22 | print(id) 23 | ''' 24 | photos_obj = Photos() 25 | 26 | 27 | @app.route('/') 28 | @app.route('/index') 29 | def index(): 30 | if 'type' in session: 31 | return redirect(url_for('galleries')) 32 | 33 | return render_template("index.html") 34 | 35 | 36 | @app.route('/login', methods=['POST']) 37 | def do_login(): 38 | if request.method == "POST": 39 | user_name = request.form['username'] 40 | password = request.form['password'] 41 | 42 | login_obj = Login() 43 | result = login_obj.login(user_name, password) 44 | print(result['type']) 45 | 46 | if result['result']: 47 | session['type'] = result['type'] 48 | 49 | response = {'success': result} 50 | return json.dumps(response) 51 | 52 | 53 | @app.route('/logout') 54 | def do_logout(): 55 | session.pop('type', None) 56 | return redirect(url_for('index')) 57 | 58 | 59 | # -------------- Gallery Routes ---------------- 60 | @app.route('/galleries') 61 | def galleries(): 62 | if 'type' in session: 63 | gallery_obj = Gallery() 64 | galleries = gallery_obj.get_all_gallery() 65 | return render_template("gallery.html", galleries=galleries, session=session) 66 | else: 67 | return redirect(url_for("index")) 68 | 69 | 70 | @app.route('/galleries/add', methods=['POST']) 71 | def add_galleries(): 72 | if 'type' in session: 73 | if request.method == "POST": 74 | gallery_name = request.form['galleryName'] 75 | 76 | gallery_obj = Gallery() 77 | result = gallery_obj.add_gallery(gallery_name) 78 | 79 | response = {'success':result} 80 | return json.dumps(response) 81 | else: 82 | response = {'success': False} 83 | return json.dumps(response) 84 | 85 | 86 | @app.route('/galleries/edit', methods=['POST']) 87 | def edit_galleries(): 88 | if request.method == "POST": 89 | new_name = request.form['newName'] 90 | gallery_name = request.form['galleryName'] 91 | 92 | gallery_obj = Gallery() 93 | result = gallery_obj.edit_gallery_name(gallery_name, new_name) 94 | 95 | response = {'success': result} 96 | return json.dumps(response) 97 | 98 | 99 | @app.route('/galleries/delete', methods=['POST']) 100 | def delete_galleries(): 101 | if request.method == "POST": 102 | gallery_name = request.form['galleryName'] 103 | 104 | gallery_obj = Gallery() 105 | result = gallery_obj.delete_gallery(gallery_name) 106 | 107 | response = {'success': result} 108 | return json.dumps(response) 109 | 110 | # -------------- Gallery Routes ---------------- 111 | 112 | 113 | # -------------- Gallery Photos Routes ---------------- 114 | @app.route('/galleries/album/', methods=['GET']) 115 | def gallery(gallery_name): 116 | if 'type' in session: 117 | photos_obj = Photos() 118 | photos = photos_obj.get_all_gallery_photos(gallery_name) 119 | return render_template("photos.html", photos=photos, gallery_folder=Gallery_Folder,gallery_name=gallery_name, session=session) 120 | else: 121 | return redirect(url_for("index")) 122 | 123 | 124 | @app.route('/galleries/album/photos/delete', methods=['POST']) 125 | def delete_gallery_photo(): 126 | if request.method == "POST": 127 | gallery_name = request.form['galleryName'] 128 | photo_name = request.form['photoName'] 129 | 130 | result = photos_obj.delete_gallery_photos(gallery_name, photo_name) 131 | 132 | response = {'success': result} 133 | return json.dumps(response) 134 | 135 | 136 | @app.route('/galleries/album//upload', methods=['GET','POST']) 137 | def upload_gallery_photo(gallery_name): 138 | app.config['UPLOAD_FOLDER'] = Gallery_Folder+gallery_name 139 | 140 | if request.method == 'POST': 141 | # check if the post request has the file part 142 | if 'file' not in request.files: 143 | return redirect(url_for('gallery', gallery_name=gallery_name)) 144 | file = request.files['file'] 145 | # if user does not select file, browser also 146 | # submit a empty part without filename 147 | if file.filename == '': 148 | msg = 'No selected file' 149 | return redirect(request.url) 150 | if file and allowed_file(file.filename): 151 | filename = secure_filename(file.filename) 152 | file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename)) 153 | return redirect(url_for('gallery', gallery_name=gallery_name)) 154 | 155 | 156 | def allowed_file(filename): 157 | return '.' in filename and \ 158 | filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS 159 | # -------------- Gallery Photos Routes ---------------- 160 | 161 | 162 | if __name__ == "__main__": 163 | app.run(debug=True) 164 | 165 | 166 | 167 | 168 | -------------------------------------------------------------------------------- /modules/Gallery.py: -------------------------------------------------------------------------------- 1 | import os 2 | from definition import * 3 | 4 | class Gallery: 5 | 6 | def __init__(self): 7 | pass 8 | 9 | ''' 10 | * Read folder names inside photo folder 11 | * @param 12 | * NONE 13 | * 14 | * @return 15 | * $final (ARRAY) 16 | ''' 17 | def get_all_gallery(self): 18 | galleries = [name for name in os.listdir(Gallery_Folder)] 19 | return galleries 20 | 21 | ''' 22 | * Create folder using the name argument 23 | * @param 24 | * $name (string) 25 | * 26 | * @return 27 | * Boolean 28 | ''' 29 | def add_gallery(self,gallery_name): 30 | if os.path.isdir(Gallery_Folder+gallery_name) is False: 31 | if os.mkdir(Gallery_Folder+gallery_name): 32 | return True 33 | else: 34 | return False 35 | 36 | 37 | ''' 38 | * Delete folder using the name argument 39 | * @param 40 | * $name (string) 41 | * 42 | * @return 43 | * Boolean 44 | ''' 45 | def delete_gallery(self, gallery_name): 46 | if os.path.isdir(Gallery_Folder+gallery_name) is True: 47 | if os.removedirs(Gallery_Folder+gallery_name): 48 | return True 49 | else: 50 | return False 51 | else: 52 | return False 53 | 54 | ''' 55 | * rename a gallery folder name 56 | * @param 57 | * $currentName (string) 58 | * $newName (string) 59 | * 60 | * @return 61 | * Boolean 62 | ''' 63 | def edit_gallery_name(self,oldName,newName): 64 | if os.path.isdir(Gallery_Folder+oldName) is True: 65 | if os.rename(Gallery_Folder+oldName, Gallery_Folder+newName): 66 | return True 67 | else: 68 | return False 69 | 70 | -------------------------------------------------------------------------------- /modules/Login.py: -------------------------------------------------------------------------------- 1 | from definition import * 2 | import json 3 | 4 | class Login: 5 | 6 | # Constructor 7 | def __init__(self): 8 | pass 9 | 10 | ''' 11 | * Handle the login feature 12 | * @param username(string) 13 | * @param password(string) 14 | * 15 | * @return Boolean 16 | ''' 17 | def login(self,username,password): 18 | data = {} 19 | logincreds = self.getcredentials() 20 | 21 | for key in logincreds: 22 | if logincreds[key]['user'] == username and logincreds[key]['password'] == password: 23 | data['type'] = logincreds[key]['type'] 24 | data['result'] = True 25 | 26 | return data 27 | return False 28 | 29 | ''' 30 | * Handle the logout feature by destroying session 31 | * @param NONE 32 | * 33 | * @return Boolean 34 | ''' 35 | def logout(self): 36 | pass 37 | 38 | ''' 39 | * Read Credentials JSON file to get saved username and password 40 | * @param NONE 41 | * 42 | * @return Array 43 | ''' 44 | def getcredentials(self): 45 | data = json.loads(open(CREDENTIALS_FILE).read()) 46 | return data['credentials'] 47 | -------------------------------------------------------------------------------- /modules/Photos.py: -------------------------------------------------------------------------------- 1 | import os 2 | from definition import * 3 | 4 | 5 | class Photos: 6 | 7 | def __init__(self): 8 | pass 9 | 10 | ''' 11 | * Read photos names inside photo folder 12 | * @param gallery_name (String) 13 | * 14 | * @return 15 | * $final (ARRAY) 16 | ''' 17 | def get_all_gallery_photos(self, gallery_name): 18 | photos = [name for name in os.listdir(Gallery_Folder+gallery_name) if(name.split(".")[0] != "Thumbs")] 19 | return photos 20 | 21 | ''' 22 | * Delete image using the name argument 23 | * @param gallery_name (string) 24 | * @param photo_name (string) 25 | * 26 | * @return 27 | * Boolean 28 | ''' 29 | def delete_gallery_photos(self, gallery_name, photo_name): 30 | if os.path.exists(Gallery_Folder + gallery_name+"/"+photo_name) is True: 31 | if os.remove(Gallery_Folder+gallery_name+"/"+photo_name): 32 | return True 33 | else: 34 | return False 35 | else: 36 | return False 37 | 38 | -------------------------------------------------------------------------------- /modules/__pycache__/Gallery.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sumairz/photo-gallery-python-flask/8ffa891c6b81772cdc063a0eca85dcda502b6a53/modules/__pycache__/Gallery.cpython-36.pyc -------------------------------------------------------------------------------- /modules/__pycache__/Login.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sumairz/photo-gallery-python-flask/8ffa891c6b81772cdc063a0eca85dcda502b6a53/modules/__pycache__/Login.cpython-36.pyc -------------------------------------------------------------------------------- /modules/__pycache__/Photos.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sumairz/photo-gallery-python-flask/8ffa891c6b81772cdc063a0eca85dcda502b6a53/modules/__pycache__/Photos.cpython-36.pyc -------------------------------------------------------------------------------- /static/css/ie10.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * IE10 viewport hack for Surface/desktop Windows 8 bug 3 | * Copyright 2014-2015 Twitter, Inc. 4 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 5 | */ 6 | 7 | /* 8 | * See the Getting Started docs for more information: 9 | * http://getbootstrap.com/getting-started/#support-ie10-width 10 | */ 11 | @-ms-viewport { width: device-width; } 12 | @-o-viewport { width: device-width; } 13 | @viewport { width: device-width; } -------------------------------------------------------------------------------- /static/css/signin.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding-top: 40px; 3 | padding-bottom: 40px; 4 | background-color: #eee; 5 | } 6 | 7 | .form-signin { 8 | max-width: 330px; 9 | padding: 15px; 10 | margin: 0 auto; 11 | } 12 | .form-signin .form-signin-heading, 13 | .form-signin .checkbox { 14 | margin-bottom: 10px; 15 | } 16 | .form-signin .checkbox { 17 | font-weight: normal; 18 | } 19 | .form-signin .form-control { 20 | position: relative; 21 | height: auto; 22 | -webkit-box-sizing: border-box; 23 | -moz-box-sizing: border-box; 24 | box-sizing: border-box; 25 | padding: 10px; 26 | font-size: 16px; 27 | } 28 | .form-signin .form-control:focus { 29 | z-index: 2; 30 | } 31 | .form-signin input[type="email"] { 32 | margin-bottom: -1px; 33 | border-bottom-right-radius: 0; 34 | border-bottom-left-radius: 0; 35 | } 36 | .form-signin input[type="password"] { 37 | margin-bottom: 10px; 38 | border-top-left-radius: 0; 39 | border-top-right-radius: 0; 40 | } -------------------------------------------------------------------------------- /static/css/thumbnail-gallery.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Start Bootstrap - Thumbnail Gallery (http://startbootstrap.com/) 3 | * Copyright 2013-2016 Start Bootstrap 4 | * Licensed under MIT (https://github.com/BlackrockDigital/startbootstrap/blob/gh-pages/LICENSE) 5 | */ 6 | 7 | body { 8 | padding-top: 70px; /* Required padding for .navbar-fixed-top. Change if height of navigation changes. */ 9 | } 10 | 11 | .thumb { 12 | margin-bottom: 30px; 13 | } 14 | 15 | footer { 16 | margin: 50px 0; 17 | } -------------------------------------------------------------------------------- /static/images/default-thumbnail.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sumairz/photo-gallery-python-flask/8ffa891c6b81772cdc063a0eca85dcda502b6a53/static/images/default-thumbnail.jpg -------------------------------------------------------------------------------- /static/images/loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sumairz/photo-gallery-python-flask/8ffa891c6b81772cdc063a0eca85dcda502b6a53/static/images/loader.gif -------------------------------------------------------------------------------- /static/js/myscript.js: -------------------------------------------------------------------------------- 1 | /***************************** Authentication Actions ******************************/ 2 | $("#loginbtn").on("click", function(){ 3 | var user = $("#username").val(); 4 | var password = $("#password").val(); 5 | var nextURL = $("#nextURL").val(); 6 | 7 | $("#loader").html(''); 8 | 9 | $.post("/login", {username: user, password: password}, function (response) { 10 | 11 | $("#loader").html(''); 12 | var response = JSON.parse(response); 13 | 14 | if (response.success) { 15 | window.location.href = nextURL; 16 | } 17 | else { 18 | $("#loader").html('

Invalid username/password

'); 19 | } 20 | }); 21 | }); 22 | 23 | 24 | $("#logoutbtn").on("click", function(){ 25 | 26 | $.post("/logout", {action: 'logout'}, function (response) { 27 | 28 | window.location.href = "index.php"; 29 | 30 | }); 31 | }); 32 | 33 | 34 | /***************************** Gallery Actions ******************************/ 35 | // Add Gallery Action 36 | $("#addGallerybtn").on("click", function(){ 37 | var galleryName = $("#galleryName").val(); 38 | 39 | if(galleryName != "") { 40 | $("#loader").html(''); 41 | 42 | $.when($.post("/galleries/add", {galleryName: galleryName}).done(function(response){ 43 | $("#loader").html(''); 44 | var response = JSON.parse(response); 45 | 46 | if (response.success) { 47 | location.reload(); 48 | } 49 | else { 50 | console.log("Error Adding Gallery"); 51 | location.reload(); 52 | } 53 | })); 54 | } 55 | }); 56 | 57 | // Delete Gallery Action 58 | $(document).on("click", '#deleteGallerybtn', function(){ 59 | //$("#deleteGallerybtn").on("click", function(){ 60 | var galleryName = $(this).data("galleryname"); 61 | 62 | if(galleryName != "") { 63 | $("#loader").html(''); 64 | 65 | $.when($.post("/galleries/delete", {galleryName: galleryName}).done(function(response){ 66 | $("#loader").html(''); 67 | var response = JSON.parse(response); 68 | console.log(response); 69 | 70 | if (response.success) { 71 | location.reload(); 72 | } 73 | else { 74 | console.log("Error deleting Gallery"); 75 | location.reload(); 76 | } 77 | })); 78 | } 79 | }); 80 | 81 | 82 | // Edit Gallery Action 83 | $(document).on("click", '#editGallerybtn', function(){ 84 | var galleryName = $(this).data("name"); 85 | $("#oldGalleryName").val(galleryName); 86 | }); 87 | 88 | // Edit Gallery Modal Action 89 | $("#editGalleryModalBtn").on("click", function(){ 90 | var newName = $("#newGalleryName").val(); 91 | var galleryName = $("#oldGalleryName").val(); 92 | 93 | if(galleryName != "") { 94 | $("#loader").html(''); 95 | 96 | $.when($.post("/galleries/edit", {galleryName: galleryName, newName: newName}).done(function(response){ 97 | $("#loader").html(''); 98 | var response = JSON.parse(response); 99 | 100 | if (response.success) { 101 | location.reload(); 102 | } 103 | else { 104 | console.log("Error renaming Gallery"); 105 | location.reload(); 106 | } 107 | })); 108 | } 109 | }); 110 | 111 | 112 | 113 | /***************************** Photos Actions ******************************/ 114 | // Delete Photo Action 115 | $(document).on("click", '#deletePhotobtn', function(){ 116 | //$("#deletePhotobtn").on("click", function(){ 117 | var galleryName = $(this).data("galleryname"); 118 | var photoName = $(this).data("photoname"); 119 | 120 | if(galleryName != "") { 121 | 122 | $.when($.post("/galleries/album/photos/delete", {galleryName: galleryName, photoName: photoName}).done(function (response) { 123 | var response = JSON.parse(response); 124 | 125 | if (response.success) { 126 | location.reload(); 127 | } 128 | else { 129 | console.log("Error Deleting Photo"); 130 | location.reload(); 131 | } 132 | })); 133 | } 134 | }); 135 | 136 | 137 | $(document).on("click", '#popImage', function(){ 138 | var imgSrc = $(this).data("imgsrc"); 139 | $('#imagepreview').attr('src', imgSrc); 140 | $('#imagemodal').modal('show'); 141 | }); 142 | 143 | // $('#popImage').on('click', function() { 144 | // $('.imagepreview').attr('src', $(this).find('img').attr('src')); 145 | // $('#imagemodal').modal('show'); 146 | // }); -------------------------------------------------------------------------------- /static/photos/Party/IMG_20160812_171153.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sumairz/photo-gallery-python-flask/8ffa891c6b81772cdc063a0eca85dcda502b6a53/static/photos/Party/IMG_20160812_171153.jpg -------------------------------------------------------------------------------- /static/photos/Party/IMG_20160829_204027.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sumairz/photo-gallery-python-flask/8ffa891c6b81772cdc063a0eca85dcda502b6a53/static/photos/Party/IMG_20160829_204027.jpg -------------------------------------------------------------------------------- /static/photos/Party/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sumairz/photo-gallery-python-flask/8ffa891c6b81772cdc063a0eca85dcda502b6a53/static/photos/Party/Thumbs.db -------------------------------------------------------------------------------- /static/photos/cars/IMG_20160920_073221.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sumairz/photo-gallery-python-flask/8ffa891c6b81772cdc063a0eca85dcda502b6a53/static/photos/cars/IMG_20160920_073221.jpg -------------------------------------------------------------------------------- /templates/_layout.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Image Gallery 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 33 | 34 | 35 | 36 | 37 | 38 | 67 | 68 |
69 | 70 | {% block body %}{% endblock %} 71 | 72 |
73 |
74 |
75 |

Copyright © Python/Flash Photo Gallery 2017

76 |
77 |
78 |
79 |
80 | 81 | 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /templates/gallery.html: -------------------------------------------------------------------------------- 1 | {% extends '_layout.html' %} 2 | 3 | {% block body %} 4 | 5 |
6 | 7 |
8 |

Galleries

9 |
10 | 11 | {% if not session.logged_in %} 12 |
13 |
14 |
15 | 16 | 17 | 18 | 19 |
20 |
21 |
22 |
23 | {% endif %} 24 | 25 |
26 |
27 | {% if galleries is defined %} 28 | {% for gallery in galleries %} 29 |
30 | 31 | 32 | {% if session['type'] == 'admin' %} 33 |
34 | 37 | 41 |
42 | {% endif %} 43 | 44 | 45 |

{{ gallery }}

46 |
47 | 48 |
49 | {% endfor %} 50 | {% else %} 51 |

No Galleries Found

52 | {% endif %} 53 |
54 |
55 | 56 | 57 | 84 | {% endblock %} -------------------------------------------------------------------------------- /templates/index.html: -------------------------------------------------------------------------------- 1 | {% extends '_layout.html' %} 2 | 3 | {% block body %} 4 | 17 | {% endblock %} -------------------------------------------------------------------------------- /templates/photos.html: -------------------------------------------------------------------------------- 1 | {% extends '_layout.html' %} 2 | {% block body %} 3 | 4 |
5 | 6 |
7 |

Photos

8 |
9 | 10 | {% if not session.logged_in %} 11 |
12 |
Only Jpeg allowed
13 |
14 |
15 |
16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 |
24 |
25 |
26 | {% endif %} 27 |
28 | 29 | {% if photos is defined %} 30 | {% for photo in photos %} 31 |
32 | 33 | 34 | 35 | 36 | {% if session['type'] == 'admin' %} 37 |
38 | 41 | 44 |
45 | {% endif %} 46 | 47 | 48 | 49 | 50 |
51 | {% endfor %} 52 | {% else %} 53 |

No Photos Found

54 | {% endif %} 55 | 56 |
57 | 58 | 59 | 60 | 72 | {% endblock %} --------------------------------------------------------------------------------