Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cant store multiple sized thumbnails with get_thumbnail() #121

Open
suneelkingrani opened this issue Jul 25, 2019 · 0 comments
Open

cant store multiple sized thumbnails with get_thumbnail() #121

suneelkingrani opened this issue Jul 25, 2019 · 0 comments

Comments

@suneelkingrani
Copy link

Hi @pylover , a nice piece of work!

I am trying to make different sizes/widths of thumbnails e.g. width=30 or width=40. For that I am following the basic setup given in your repository /examples/flask. But for some reason I am unable to save/update multiple thumbnails.

suppose I have a Person with an avatar field defined and I want to create two different sized thumbnails:

with StoreManager(db.session()):
	thumbnail = person1.avatar.get_thumbnail(width=32, auto_generate=True)
	db.session.commit()

The value of avatar field in DB, after running the code lines above:

{"key": "ae01a10b-e33f-4234-a1ad-aa32c01ca92c", "extension": ".png", "content_type": "image/png", "reproducible": false, "width": 128, "height": 125, "length": 28101, "timestamp": "1564068229.4194794", "thumbnails": [[32, 31, 0.25, {"key": "54813146-c03c-42c0-8ebe-91d505055ab5", "width": 32, "height": 31, "extension": ".png", "content_type": "image/png", "reproducible": false, "length": 2272, "timestamp": "1564071128.3401299"}]]}

and when I re run the same code to get another thumbnail of different width (40) i.e.:

with StoreManager(db.session()):
	thumbnail = person1.avatar.get_thumbnail(width=40, auto_generate=True)
	db.session.commit()

It does not change anything in avatar field in DB, though I guess it is supposed to append a list for another thumbnail in avatar thumbnails.
Also re running the method get_thumbnail(width=40, auto_generate=True), keeps making new image files in thumbnail directory and changes nothing in the DB.

Can you please let me know if I am doing something wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant