@@ -537,11 +537,18 @@ def upload_images_from_folder_to_project(
537537
538538
539539def 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
541541):
542542 bucket .put_object (Body = orig_image , Key = key )
543543 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+ )
545552 bucket .put_object (Body = thumbnail_image , Key = key + '___thumb.jpg' )
546553
547554
@@ -600,7 +607,9 @@ def get_image_array_to_upload(
600607 byte_io_huge .seek (0 )
601608 byte_io_orig .seek (0 )
602609
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
604613
605614
606615def __upload_images_to_aws_thread (
@@ -643,10 +652,10 @@ def __upload_images_to_aws_thread(
643652 raise SAImageSizeTooLarge (file_size )
644653 with open (path , "rb" ) as f :
645654 file = io .BytesIO (f .read ())
646- images = get_image_array_to_upload (
655+ images_array = get_image_array_to_upload (
647656 file , image_quality_in_editor , project ["type" ]
648657 )
649- upload_image_array_to_s3 (bucket , * images , key )
658+ upload_image_array_to_s3 (bucket , * images_array , key )
650659 except Exception as e :
651660 logger .warning ("Unable to upload image %s. %s" , path , e )
652661 couldnt_upload [thread_id ].append (path )
0 commit comments