image size to image model
This commit is contained in:
@@ -10,6 +10,8 @@ from rowers.tasks import (
|
||||
|
||||
from rowers.models import GraphImage
|
||||
|
||||
from PIL import Image
|
||||
|
||||
import numpy as np
|
||||
import yaml
|
||||
import argparse
|
||||
@@ -181,10 +183,16 @@ def make_plot(r,w,f1,f2,plottype,title,imagename='',plotnr=0):
|
||||
title,hrpwrdata,
|
||||
plotnr,imagename)
|
||||
|
||||
|
||||
try:
|
||||
width,height = Image.open(fullpathimagename).size
|
||||
except:
|
||||
width = 1200
|
||||
height = 600
|
||||
|
||||
i = GraphImage(workout=w,
|
||||
creationdatetime=timezone.now(),
|
||||
filename=fullpathimagename)
|
||||
filename=fullpathimagename,
|
||||
width=width,height=height)
|
||||
i.save()
|
||||
|
||||
return i.id
|
||||
|
||||
Reference in New Issue
Block a user