@@ -537,11 +537,18 @@ def upload_images_from_folder_to_project(
537
537
538
538
539
539
def upload_image_array_to_s3 (
540
- bucket , orig_image , lores_image , huge_image , thumbnail_image , key
540
+ bucket , size , orig_image , lores_image , huge_image , thumbnail_image , key
541
541
):
542
542
bucket .put_object (Body = orig_image , Key = key )
543
543
bucket .put_object (Body = lores_image , Key = key + '___lores.jpg' )
544
- bucket .put_object (Body = huge_image , Key = key + '___huge.jpg' )
544
+ bucket .put_object (
545
+ Body = huge_image ,
546
+ Key = key + '___huge.jpg' ,
547
+ Metadata = {
548
+ 'height' : str (size [1 ]),
549
+ 'width' : str (size [0 ])
550
+ }
551
+ )
545
552
bucket .put_object (Body = thumbnail_image , Key = key + '___thumb.jpg' )
546
553
547
554
@@ -600,7 +607,9 @@ def get_image_array_to_upload(
600
607
byte_io_huge .seek (0 )
601
608
byte_io_orig .seek (0 )
602
609
603
- return byte_io_orig , byte_io_lores , byte_io_huge , byte_io_thumbs
610
+ return (
611
+ width , height
612
+ ), byte_io_orig , byte_io_lores , byte_io_huge , byte_io_thumbs
604
613
605
614
606
615
def __upload_images_to_aws_thread (
@@ -643,10 +652,10 @@ def __upload_images_to_aws_thread(
643
652
raise SAImageSizeTooLarge (file_size )
644
653
with open (path , "rb" ) as f :
645
654
file = io .BytesIO (f .read ())
646
- images = get_image_array_to_upload (
655
+ images_array = get_image_array_to_upload (
647
656
file , image_quality_in_editor , project ["type" ]
648
657
)
649
- upload_image_array_to_s3 (bucket , * images , key )
658
+ upload_image_array_to_s3 (bucket , * images_array , key )
650
659
except Exception as e :
651
660
logger .warning ("Unable to upload image %s. %s" , path , e )
652
661
couldnt_upload [thread_id ].append (path )
0 commit comments