I have a model for image url in django. I want to calculate the image_height and iamge_width of image which is stored in s3 bucket.Below is my model.py
from django.db import models
from .project_model import Project
class Image(models.Model):
image = models.TextField(blank=False)
image_width = models.IntegerField(default=0)
image_height = models.IntegerField(default=0)
project_id = models.ForeignKey(Project, on_delete=models.CASCADE)
is_thumpnail = models.BooleanField(blank=False)
upload_on = models.DateTimeField("created on", auto_now_add=True)
updated_on = models.DateTimeField("updated on", auto_now=True)
def __str__(self):
return self.file_name
After getting the value of height and width, I want to store the value in the model.py.
I am looking for below type of response example
{
"id": "cJ9cm",
"title": null,
"description": null,
"datetime": 1357856330,
"type": "image/jpeg",
"animated": false,
"width": 2592,
"height": 1944,
"size": 544702,
"views": 31829,
"bandwidth": 17337319958,
"link": "https://i.imgur.com/cJ9cm.jpg"
}