Python Forum
Download images generated by user input
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Download images generated by user input
I'm building an web app that allows users to download images based on they input. The main url is constant, the filename is known by user and is used as input. The amount of pictures could vary from 1 to 7. I'm able to generate the urls for the pictures, but I can't figure out how to zip and download them.

I tried with jszip(see in index.html file) but I can't figure out how to connect it so it generates the zip file and download all existing images from 1 to 7. looks like this :

from flask import Flask, jsonify, render_template, request

app = Flask(__name__)

def index():
    return render_template('index.html')

@app.route('/generate', methods=['GET'])
def generate():
    prefix = request.args.get('prefix')
    urls = []
    for number in range(1, 8):
        urls.append('{p}-{n}.jpg'.format(p=prefix, n=number))
    return jsonify(result=urls)
index.html looks like this :

Expecting to generate the zip file when clicked the download button and download it.

Not happening anything just the urls are generated. Think I'm missing something small but can't figure out what exactly :(

On input try this : AMSPP-BL

Possibly Related Threads…
Thread Author Replies Views Last Post
  Cant Download Images from Unsplash Website firaki12345 1 1,012 Feb-08-2021, 04:15 PM
Last Post: buran
  User Input to mySQL database newbie1 3 2,129 Aug-26-2020, 10:42 AM
Last Post: newbie1
  Flask: Cookies for Saving User Input ? jomonetta 2 2,191 Nov-03-2018, 10:47 AM
Last Post: j.crater
  Web scraping User Generated Content StephenG93 2 1,927 Oct-10-2018, 12:17 AM
Last Post: StephenG93
  Pulling any information from a dictionary with a user input Darmanus 19 5,244 Nov-22-2017, 08:56 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020