Skip to content

Conversation

@korabelnikov
Copy link

#2

Comment on lines +72 to +80
images_info = [(x.file.url, x.width, x.height) for x in files]

def get_num(im_info):
url = im_info[0]
name = os.path.split(url)[-1]
num = os.path.splitext(name)[0]
return int(num)

images_info = sorted(images_info, key=get_num)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The solution might fail when some one uploads set of images with names having character and numbers.
e.g. : image_0001.jpg, image_002.jpg etc.
In such a case, int(image_001) would give a ValueError: invalid literal for int( )

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I needed this fix for video, so some modification like single if-else may be needed to work with images

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

Successfully merging this pull request may close these issues.

2 participants