rambo před 5 dny
rodič
revize
341a41bc3b

+ 19 - 12
python/custom_plugins/plugins/detail_template/xiaosushuoxie/detail_xiaosushuoxie7.py

@@ -94,8 +94,12 @@ class DetailPicGet(DetailBase):
                     
                     # 处理模特图(包括模特图、模特图2、模特图3等)
                     elif name_part.startswith('模特图'):
-                        # 验证是否是模特图的正确格式(模特图 或 模特图+数字)
-                        if name_part == '模特图' or re.match(r'^模特图\d+$', name_part):
+                       # 验证是否是模特图的正确格式(模特图 或 模特图+数字)
+                        if name_part == '模特图':
+                            # 没有数字的默认为第1张
+                            collected_images['模特图'].append(file_path)
+                        elif re.match(r'^模特图\d+$', name_part):
+                            # 提取数字部分
                             collected_images['模特图'].append(file_path)
         
         return collected_images
@@ -140,7 +144,7 @@ class DetailPicGet(DetailBase):
         mainTitle = self.get_text_value("主标题")
         subTitle = self.get_text_value("副标题")
         signTitle = self.get_text_value("签名")
-        fontMain = ImageFont.truetype(r"resources\ttf\DOUYINSANSBOLD.ttf", 240)
+        fontMain = ImageFont.truetype(r"resources\ttf\DOUYINSANSBOLD.ttf", 200)
         fontSub = ImageFont.truetype(r"resources\ttf\puhui\Regular.ttf", 40)
         fontSign = ImageFont.truetype(r"resources\ttf\puhui\en\Bold.otf", 40)
         main_text_bg = PictureProcessing("RGBA", (pp_bg.width, 500), (255, 255, 255,0))
@@ -183,12 +187,13 @@ class DetailPicGet(DetailBase):
                 self.root
             )
         )
-        pp_bg.paste_img(top_img=bottom_bg, value=(0, 0),base='cs')
+        # pp_bg.paste_img(top_img=bottom_bg, value=(0, 0),base='cs')
         if cover_image:
             cover_image_pp = PictureProcessing(cover_image)
             cover_image_pp = cover_image_pp.resize(value=(pp_bg.width))
-            pp_bg = pp_bg.resize(value=(cover_image_pp.height),base='high')
-            cover_image_pp.paste_img(top_img=pp_bg, value=(0, 0),base='cs')
+            # pp_bg = pp_bg.resize(value=(cover_image_pp.height),base='high')
+            cover_image_pp.paste_img(top_img=pp_bg, value=(0, 0),base='nc')
+            cover_image_pp.paste_img(top_img=bottom_bg, value=(0, -40),base='cs')
             detailed_images.append(cover_image_pp)
         else:
             detailed_images.append(pp_bg)
@@ -205,7 +210,8 @@ class DetailPicGet(DetailBase):
                 self.root
             )
         )
-        # detailed_images.append(top_bg)
+        temp_pp = PictureProcessing("RGB", (top_bg.width, 90), self.white_bg_color)
+        detailed_images.append(temp_pp)
         designText1 = self.get_text_value("设计理念1")
         designText2 = self.get_text_value("设计理念2")
         designText3 = self.get_text_value("设计理念3")
@@ -572,13 +578,13 @@ class DetailPicGet(DetailBase):
         x_position = top_bg.width*0.15
         text_array = [
             {"text":"品牌","position":(x_position,50),"default":"小苏",'base':'nw'},
-            {"text":"货号","position":(x_position,50),"default":"未填写",'base':'en'},
+            {"text":"货号","position":(740,50),"default":"未填写",'base':'nw'},
             {"text":"鞋面","position":(x_position,120),"default":"未填写",'base':'nw'},
-            {"text":"内里","position":(x_position,120),"default":"未填写",'base':'en'},
+            {"text":"内里","position":(740,120),"default":"未填写",'base':'nw'},
             {"text":"鞋垫","position":(x_position,190),"default":"未填写",'base':'nw'},
-            {"text":"鞋底","position":(x_position,190),"default":"未填写",'base':'en'},
+            {"text":"鞋底","position":(740,190),"default":"未填写",'base':'nw'},
             ]
-        size_font = ImageFont.truetype(r"resources\ttf\puhui\Medium.ttf", 40)
+        size_font = ImageFont.truetype(r"resources\ttf\puhui\Medium.ttf", 35)
         for item in text_array:
             text_flag = item["text"]
             position = item["position"]
@@ -596,6 +602,7 @@ class DetailPicGet(DetailBase):
                     fill=self.black_bg_color,
                     spacing=5,
                     return_mode="min_image",
+                    max_len_one_line=15
                 )
             attiribute.paste_img(top_img=gen_gao_bg, value=position,base=base)
         bottom = PictureProcessing(r"{}\bottom.jpg".format(self.root))
@@ -610,7 +617,7 @@ class DetailPicGet(DetailBase):
         detailed_images.append(bg_bottom)
         # ==========添加颜色===================
         pp_list_1 = []
-        font = ImageFont.truetype(r"resources\ttf\puhui\Medium.ttf", 25)
+        font = ImageFont.truetype(r"resources\ttf\puhui\Medium.ttf", 35)
         goods_art_no_list = list(self.data.keys())
 
         all_color_name = []