File Size
See original GitHub issueIssue Description
Hi, first of all nice library, i wanna ask if it’s possible to retrieve generated file size in some place, i have a signal to compute and save my image size but i can’t find the variations size.
def compute_size(instance, raw, **kwargs):
if hasattr(instance, 'image') and instance.image and not raw: # Required check for tests and fixtures
user = instance.exercise.created_by if isinstance(instance, ExerciseImage) else instance.comment.user
total_size = instance.image.size
if hasattr(instance.image, 'variations'): # Never runs
for variation in instance.image.variations:
total_size += variation.size
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
File size - Wikipedia
File size is a measure of how much data a computer file contains or, alternately, how much storage it consumes. Typically, file size...
Read more >What Is The File Size? - Metadata2Go.com
The size of a file is the amount of space it takes up on your hard drive. The File Size is measured in...
Read more >File Size Calculator - File Size Explained - MindGems
File size calculator will convert file sizes to any units of measure - bits, bytes, kilobytes, megabytes, gigabytes, terabytes, or petabytes.
Read more >File Sizes and Transfer Speeds - 2BrightSparks
File sizes are measured in Bytes (B), Kilobytes (KB), Megabytes (MB), Gigabytes (GB), Terabytes (TB) and so on. The file sizes can be...
Read more >What is File Size? - Computer Hope
A file size is the measure of space a file takes up on a storage medium, such as a computer hard drive. File...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I honestly never tried that. Mostly because the variation size is kind of specified is it not? At least it’s max bounds. that being said, you don’t have access to the variations at this point, because they did not exist when class was created. Mostly because you are creating a new object. You would need to call
set_variations
manually. It’s usually called incontribute_to_class
which in tern is called when a Django model is constructed. As I said, not in this particular case.I hope that helps you, let me know if I can be of more help.
Sorry, same error
I also try debugging it but the object only contains errors like:
The image is still created even if the signal fail.