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
#1
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.

app.py looks like this :

from flask import Flask, jsonify, render_template, request

app = Flask(__name__)

@app.route('/')
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('https://img.tenniswarehouse-europe.com/new_big/{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
Reply


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

Forum Jump:

User Panel Messages

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