From 7e2184692edd124c6ecdbcc25cc15a2ad3ff78d3 Mon Sep 17 00:00:00 2001 From: JazzyNico Date: Thu, 15 Apr 2010 21:56:04 +0200 Subject: [PATCH] Extensions. Extract Image fix for uppercase image type, and default path set to the user's home directory. --- share/extensions/extractimage.inx | 5 +++-- share/extensions/extractimage.py | 10 ++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/share/extensions/extractimage.inx b/share/extensions/extractimage.inx index 364898c51..984dc9aef 100644 --- a/share/extensions/extractimage.inx +++ b/share/extensions/extractimage.inx @@ -4,8 +4,9 @@ org.ekips.filter.extractimage extractimage.py inkex.py - none - <_param name="desc" type="description">Note: The file extension is appended automatically. + none + <_param name="desc" type="description" xml:space="preserve">* Don't type the file extension, it is appended automatically. +* A relative path (or a filename without path) is relative to the user's home directory. all diff --git a/share/extensions/extractimage.py b/share/extensions/extractimage.py index 8b47de958..4093b94a7 100644 --- a/share/extensions/extractimage.py +++ b/share/extensions/extractimage.py @@ -54,10 +54,16 @@ class MyEffect(inkex.Effect): semicolon = xlink.find(';') if semicolon>0: for sub in mimesubext.keys(): - if sub in xlink[5:semicolon]: + if sub in xlink[5:semicolon].lower(): fileext=mimesubext[sub] path=path+fileext; - break + if (not os.path.isabs(path)): + if os.name == 'nt': + path = os.path.join(os.environ['USERPROFILE'],path) + else: + path = os.path.join(os.path.expanduser("~"),path) + inkex.errormsg(_('Image extracted to: %s') % path) + break #save data = base64.decodestring(xlink[comma:]) open(path,'wb').write(data) -- 2.30.2