This commit is contained in:
lwl0608 2024-04-29 11:34:36 +08:00
parent ef78a2b8ab
commit 90b40476ec
1 changed files with 6 additions and 3 deletions

View File

@ -1,6 +1,7 @@
from pymongo import UpdateOne
from lib.all import *
import oss2
from cryptography.hazmat.backends import default_backend as _default_backend
service_name = 'compress'
log_dir = '/app/log'
@ -37,17 +38,19 @@ class S:
def proc_oen(self):
# 获取所有heic图片
q = {"fmt": "image/heic"}
images = self.col_image.find(q, limit=5)
images = self.col_image.find(q, limit=1)
for img in images:
print(img)
old_key = safe_get_str(img, "src_id")
new_key = old_key + "_h2j"
arr = old_key.split("/")
local_path = arr[len(arr) - 1] + ".jpeg"
ret = self.heic_to_jpg_and_save(old_key, local_path)
logger.Info("heic_to_jpg_and_save, ret: {}".format(ret))
ret_save = self.heic_to_jpg_and_save(old_key, local_path)
logger.Info("heic_to_jpg_and_save, ret: {}".format(ret_save.resp))
# ret_upload = self.upload_img_to_oss(local_path, new_key)
s = S()
s.proc_oen()