remove last remnants of rotate instead of transform, updated rot* svgs to have arrow point in direction of actual rotation, AND, fixed bug where when we rotate an image that has already had an exif_transform on it, then we have to do that and then the requested rotation - fixes why sometimes we rotate say 180 when we intended a 90 rotate. Also, when we transform, recalc md5 as file has changed
This commit is contained in:
25
files.py
25
files.py
@@ -519,40 +519,37 @@ def view_img(id):
|
|||||||
face.locn = json.loads(face.locn)
|
face.locn = json.loads(face.locn)
|
||||||
return render_template("viewer.html", current=int(id), eids=eids, objs=objs, OPT=OPT )
|
return render_template("viewer.html", current=int(id), eids=eids, objs=objs, OPT=OPT )
|
||||||
|
|
||||||
# route called from front/end - if multiple images are being rotated, each rotation == a separate call
|
# route called from front/end - if multiple images are being transformed, each transorm == a separate call
|
||||||
# to this route (and therefore a separate rotate job. Each reponse allows the f/e to check the
|
# to this route (and therefore a separate transorm job. Each reponse allows the f/e to check the
|
||||||
# specific rotation job is finished (/checkrotatejob) which will be called (say) every 1 sec. from f/e
|
# specific transorm job is finished (/checktransformjob) which will be called (say) every 1 sec. from f/e
|
||||||
# with a spinning wheel, then when pa_job_mgr has finished it will return the rotated thumb
|
# with a spinning wheel, then when pa_job_mgr has finished it will return the transformed thumb
|
||||||
@app.route("/rotate", methods=["POST"])
|
|
||||||
@app.route("/transform", methods=["POST"])
|
@app.route("/transform", methods=["POST"])
|
||||||
@login_required
|
@login_required
|
||||||
def rotate():
|
def transform():
|
||||||
id = request.form['id']
|
id = request.form['id']
|
||||||
amt = request.form['amt']
|
amt = request.form['amt']
|
||||||
print( f"rotate called with id={id}, amt={amt}")
|
print( f"transform called with id={id}, amt={amt}")
|
||||||
|
|
||||||
jex=[]
|
jex=[]
|
||||||
for el in request.form:
|
for el in request.form:
|
||||||
jex.append( JobExtra( name=f"{el}", value=request.form[el] ) )
|
jex.append( JobExtra( name=f"{el}", value=request.form[el] ) )
|
||||||
|
|
||||||
job=NewJob( "rotate_image", 0, None, jex )
|
job=NewJob( "transform_image", 0, None, jex )
|
||||||
|
|
||||||
resp={}
|
resp={}
|
||||||
resp['job_id']=job.id
|
resp['job_id']=job.id
|
||||||
|
|
||||||
# TODO: make this return data with the job number, then the f/e can poll checkrotatejob
|
|
||||||
return resp
|
return resp
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# /checkrotatejob -> URL that is called repeatedly by front-end waiting for the
|
# /checktransformjob -> URL that is called repeatedly by front-end waiting for the
|
||||||
# b/e to finish the rotate job. Once done, the new / now
|
# b/e to finish the transform job. Once done, the new / now
|
||||||
# rotated image's thumbnail is returned so the f/e can
|
# transformed image's thumbnail is returned so the f/e can
|
||||||
# update with it
|
# update with it
|
||||||
################################################################################
|
################################################################################
|
||||||
@app.route("/checktransformjob", methods=["POST"])
|
@app.route("/checktransformjob", methods=["POST"])
|
||||||
@app.route("/checkrotatejob", methods=["POST"])
|
|
||||||
@login_required
|
@login_required
|
||||||
def checkrotatejob():
|
def checktransformjob():
|
||||||
job_id = request.form['job_id']
|
job_id = request.form['job_id']
|
||||||
job = Job.query.get(job_id)
|
job = Job.query.get(job_id)
|
||||||
resp={}
|
resp={}
|
||||||
|
|||||||
Reference in New Issue
Block a user