mirror of
https://gitee.com/g1879/DrissionPage.git
synced 2024-12-10 04:00:23 +08:00
get_screenshot()兼容旧版本path参数
This commit is contained in:
parent
1015d6c076
commit
9690a57502
@ -881,13 +881,15 @@ class ChromiumBase(BasePage):
|
||||
pic_type = 'jpeg' if as_base64 == 'jpg' else as_base64
|
||||
|
||||
else:
|
||||
if not name:
|
||||
name = f'{self.title}.jpg'
|
||||
if not path:
|
||||
path = '.'
|
||||
if not name.endswith(('.jpg', '.jpeg', '.png', '.webp')):
|
||||
name = f'{name}.jpg'
|
||||
path = get_usable_path(f'{path}{sep}{name}')
|
||||
path = str(path).rstrip('\\/') if path else '.'
|
||||
if not path.endswith(('.jpg', '.jpeg', '.png', '.webp')):
|
||||
if not name:
|
||||
name = f'{self.title}.jpg'
|
||||
elif not name.endswith(('.jpg', '.jpeg', '.png', '.webp')):
|
||||
name = f'{name}.jpg'
|
||||
path = f'{path}{sep}{name}'
|
||||
|
||||
path = get_usable_path(path)
|
||||
pic_type = path.suffix.lower()
|
||||
pic_type = 'jpeg' if pic_type == '.jpg' else pic_type[1:]
|
||||
|
||||
|
@ -535,13 +535,16 @@ class ChromiumFrame(ChromiumBase):
|
||||
pic_type = 'jpeg' if as_base64 == 'jpg' else as_base64
|
||||
|
||||
else:
|
||||
if not path:
|
||||
path = '.'
|
||||
if not name:
|
||||
name = f'{self.title}.jpg'
|
||||
if not name.endswith(('.jpg', '.jpeg', '.png', '.webp')):
|
||||
name = f'{name}.jpg'
|
||||
pic_type = name.split('.')[-1]
|
||||
path = str(path).rstrip('\\/') if path else '.'
|
||||
if path and path.endswith(('.jpg', '.jpeg', '.png', '.webp')):
|
||||
pic_type = path.rsplit('.', 1)[-1]
|
||||
|
||||
elif name and name.endswith(('.jpg', '.jpeg', '.png', '.webp')):
|
||||
pic_type = name.rsplit('.', 1)[-1]
|
||||
|
||||
else:
|
||||
pic_type = 'jpeg'
|
||||
|
||||
if pic_type == 'jpg':
|
||||
pic_type = 'jpeg'
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user