合并字段
This commit is contained in:
		@@ -55,12 +55,12 @@ def get_image_type_thumbnail(type:str, id:str, version:str, n:int, w:int, ext:st
 | 
			
		||||
            if os.path.exists(img_path):
 | 
			
		||||
                return Response(content=open(img_path, 'rb').read(), media_type=f"image/{ext}")
 | 
			
		||||
            if type == 'ad' or type == 'article' or type == 'article_attribute':
 | 
			
		||||
                count = cursor.execute(f"SELECT * FROM `web_{type}` WHERE `id`={id}")
 | 
			
		||||
                count = cursor.execute(f"SELECT image FROM `web_{type}` WHERE `id`={id}")
 | 
			
		||||
                img = cursor.fetchone()
 | 
			
		||||
                if img is None:
 | 
			
		||||
                    print('图片不存在:', count)
 | 
			
		||||
                    return Response('图片不存在', status_code=404)
 | 
			
		||||
                url = img['image']
 | 
			
		||||
                url = img[0]
 | 
			
		||||
            elif type == 'url':
 | 
			
		||||
                id = unquote(id, 'utf-8')
 | 
			
		||||
                id = id.replace(' ','+')
 | 
			
		||||
@@ -149,12 +149,12 @@ def get_image_thumbnail(id:int, version:str, n:int, w:int, ext:str):
 | 
			
		||||
            if os.path.exists(img_path):
 | 
			
		||||
                return Response(content=open(img_path, 'rb').read(), media_type=f"image/{ext}")
 | 
			
		||||
            # 从数据库获取原图地址
 | 
			
		||||
            cursor.execute(f"SELECT * FROM `web_images` WHERE `id`={id}")
 | 
			
		||||
            cursor.execute(f"SELECT content FROM `web_images` WHERE `id`={id}")
 | 
			
		||||
            img = cursor.fetchone()
 | 
			
		||||
            if img is None:
 | 
			
		||||
                print('图片不存在:', id)
 | 
			
		||||
                return Response('图片不存在', status_code=404)
 | 
			
		||||
            image = download_image(img['content'])
 | 
			
		||||
            image = download_image(img[0])
 | 
			
		||||
            if not image:
 | 
			
		||||
                return Response('图片不存在', status_code=404)
 | 
			
		||||
            image.thumbnail((n*w, image.size[1]))
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user