mirror of
https://github.com/LC044/WeChatMsg
synced 2025-02-22 10:52:18 +08:00
修复图片都是缩略图的问题
This commit is contained in:
parent
7099ce35cd
commit
b793a4424a
@ -55,12 +55,7 @@ class HtmlExporter(ExporterBase):
|
|||||||
avatar = self.get_avatar_path(is_send, message)
|
avatar = self.get_avatar_path(is_send, message)
|
||||||
display_name = self.get_display_name(is_send, message)
|
display_name = self.get_display_name(is_send, message)
|
||||||
str_content = escape_js_and_html(str_content)
|
str_content = escape_js_and_html(str_content)
|
||||||
image_path = hard_link_db.get_image(str_content, BytesExtra, thumb=False)
|
image_path = hard_link_db.get_image(str_content, BytesExtra, up_dir=Me().wx_dir, thumb=False)
|
||||||
if not os.path.exists(os.path.join(Me().wx_dir, image_path)):
|
|
||||||
image_thumb_path = hard_link_db.get_image(str_content, BytesExtra, thumb=True)
|
|
||||||
if not os.path.exists(os.path.join(Me().wx_dir, image_thumb_path)):
|
|
||||||
return
|
|
||||||
image_path = image_thumb_path
|
|
||||||
image_path = get_image_path(image_path, base_path=f'/data/聊天记录/{self.contact.remark}/image')
|
image_path = get_image_path(image_path, base_path=f'/data/聊天记录/{self.contact.remark}/image')
|
||||||
doc.write(
|
doc.write(
|
||||||
f'''{{ type:{type_}, text: '{image_path}',is_send:{is_send},avatar_path:'{avatar}',timestamp:{timestamp},is_chatroom:{is_chatroom},displayname:'{display_name}'}},'''
|
f'''{{ type:{type_}, text: '{image_path}',is_send:{is_send},avatar_path:'{avatar}',timestamp:{timestamp},is_chatroom:{is_chatroom},displayname:'{display_name}'}},'''
|
||||||
|
@ -226,14 +226,14 @@ class HardLink:
|
|||||||
result = dat_image
|
result = dat_image
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def get_image(self, content, bytesExtra, thumb=False) -> str:
|
def get_image(self, content, bytesExtra, up_dir="", thumb=False) -> str:
|
||||||
msg_bytes = MessageBytesExtra()
|
msg_bytes = MessageBytesExtra()
|
||||||
msg_bytes.ParseFromString(bytesExtra)
|
msg_bytes.ParseFromString(bytesExtra)
|
||||||
if thumb:
|
if thumb:
|
||||||
result = self.get_image_thumb(content, bytesExtra)
|
result = self.get_image_thumb(content, bytesExtra)
|
||||||
else:
|
else:
|
||||||
result = self.get_image_original(content, bytesExtra)
|
result = self.get_image_original(content, bytesExtra)
|
||||||
if not (result and os.path.exists(result)):
|
if not (result and os.path.exists(os.path.join(up_dir, result))):
|
||||||
result = self.get_image_thumb(content, bytesExtra)
|
result = self.get_image_thumb(content, bytesExtra)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
@ -379,12 +379,7 @@ class OutputImage(QThread):
|
|||||||
BytesExtra = message[10]
|
BytesExtra = message[10]
|
||||||
timestamp = message[5]
|
timestamp = message[5]
|
||||||
try:
|
try:
|
||||||
image_path = hard_link_db.get_image(str_content, BytesExtra, thumb=False)
|
image_path = hard_link_db.get_image(str_content, BytesExtra, up_dir=Me().wx_dir,thumb=False)
|
||||||
if not os.path.exists(os.path.join(Me().wx_dir, image_path)):
|
|
||||||
image_thumb_path = hard_link_db.get_image(str_content, BytesExtra, thumb=True)
|
|
||||||
if not os.path.exists(os.path.join(Me().wx_dir, image_thumb_path)):
|
|
||||||
continue
|
|
||||||
image_path = image_thumb_path
|
|
||||||
image_path = get_image(image_path, base_path=f'/data/聊天记录/{self.contact.remark}/image')
|
image_path = get_image(image_path, base_path=f'/data/聊天记录/{self.contact.remark}/image')
|
||||||
try:
|
try:
|
||||||
os.utime(origin_docx_path + image_path[1:], (timestamp, timestamp))
|
os.utime(origin_docx_path + image_path[1:], (timestamp, timestamp))
|
||||||
|
@ -134,7 +134,7 @@ class ChatInfo(QWidget):
|
|||||||
time_message = Notice(self.last_str_time)
|
time_message = Notice(self.last_str_time)
|
||||||
self.last_str_time = str_time
|
self.last_str_time = str_time
|
||||||
self.chat_window.add_message_item(time_message, 0)
|
self.chat_window.add_message_item(time_message, 0)
|
||||||
image_path = hard_link_db.get_image(content=str_content, bytesExtra=BytesExtra, thumb=False)
|
image_path = hard_link_db.get_image(content=str_content, bytesExtra=BytesExtra, up_dir=Me().wx_dir,thumb=False)
|
||||||
image_path = get_abs_path(image_path)
|
image_path = get_abs_path(image_path)
|
||||||
bubble_message = BubbleMessage(
|
bubble_message = BubbleMessage(
|
||||||
image_path,
|
image_path,
|
||||||
|
Loading…
Reference in New Issue
Block a user