![]() |
#1 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 202
Karma: 62362
Join Date: Jul 2015
Device: Sony
|
Plugin to insert and wrap an image with SVG
Description
The attached plugin will enable you to select an image that already exists in your ePub book or import an external image and then insert it in a new or existing xhtml section, wrapping it with SVG tags. How to use the plugin Please see the attached user guide. UPDATE I have updated this plugin to version 0.2.1.0 to put an image on the clipboard from one that already exists in your ePub book or from an external image. The image on the clipboard is surrounded by SVG tags. The image and these tags can then be pasted into any part of your ePub.
After pasting in the image and SVG code, you may want to add a class to the <div> wrapper eg div.breakavoid {page-break-inside: avoid;} as suggested by AlanHK. I have updated this plugin to version 0.2.1.1. This version has the following improvements:
I have updated this plugin to version 0.2.1.3 to fix a small bug. Update I have updated this plugin to version 0.2.1.4 to reflect an update in one of the libraries that this plugin depends on. Please note that if you are using Sigil 0.99 then the first time you run the plugin it will try to run again when an image has been imported. To get round this issue please close Sigil after installing the plugin. You can then use the plugin next time you open Sigil. Last edited by CalibUser; 11-17-2023 at 06:43 AM. Reason: Updated user guide to v0.2.1.3. |
![]() |
![]() |
![]() |
#2 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 27,798
Karma: 198099188
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Thanks! I'll get it added to the plugin index.
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Connoisseur
![]() Posts: 99
Karma: 10
Join Date: Jun 2014
Location: Poland, Żory
Device: Prestigio PER3464B, Onyx Lynx, Lenovo S5000 i Tab4-8"
|
@CalibUser...
When you attempt to use the plug getting the message. ![]() bravosx |
![]() |
![]() |
![]() |
#4 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,634
Karma: 23190435
Join Date: Dec 2010
Device: Kindle PW2
|
@bravosx: The plugin works fine on my Windows 10 machine. Did you check the Use Bundled Python box in the Manage Plugins dialog box?
If so, you'll need to post the steps that caused this message to be displayed, unless it's being displayed immediately after running the plugin. |
![]() |
![]() |
![]() |
#5 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 27,798
Karma: 198099188
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
The epub he opened probably has no images in it. I get the same error when launching the plugin when no images exist (in the plugin). Works fine on Linux, otherwise.
Just needs a way to handle the empty list situation, is all. EDIT: I take that back. It's not the images. The error happens when an epub only has 1 xhtml file. One of the combo boxes is set to default to the second entry in the list ... but a brand-new epub only has one xhtml file. Last edited by DiapDealer; 02-05-2017 at 05:51 PM. |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Connoisseur
![]() Posts: 99
Karma: 10
Join Date: Jun 2014
Location: Poland, Żory
Device: Prestigio PER3464B, Onyx Lynx, Lenovo S5000 i Tab4-8"
|
@Doitsu...
@DiapDealer... Field: of Use Bundled Python box in the Manage Plugins dialog box is checked. An error message is given a moment after starting the plug. Images are included eo Images directory. edit: The plugin works properly when epub is a lot of files in the folder text. Sorry for my English. Regards bravosx Last edited by bravosx; 02-05-2017 at 06:09 PM. |
![]() |
![]() |
![]() |
#7 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
Thanks! I will wait for an update for the reported bug though!
|
![]() |
![]() |
![]() |
#8 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 27,798
Karma: 198099188
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Some suggestions in the attached patch.
In addition to the index error, I'd suggest populating the combo box with the xhtml file _names_, rather than their manifest ids. Many people won't recognize those offhand. Also the image file filter is broken on the openfile dialog. My png files wouldn't show up unless I changed to "All files". Yours to do with what you will, of course. Thanks for the plugin! ![]() Last edited by DiapDealer; 02-06-2017 at 10:33 AM. |
![]() |
![]() |
![]() |
#9 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 202
Karma: 62362
Join Date: Jul 2015
Device: Sony
|
Thanks for the bug report and for the suggested patch - I have uploaded a correction in the first post of this thread
Last edited by CalibUser; 02-06-2017 at 03:21 PM. |
![]() |
![]() |
![]() |
#10 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 202
Karma: 62362
Join Date: Jul 2015
Device: Sony
|
I have updated the plugin in the first post of this thread.
I am not sure what you were referring to - the combo box showed the names of the xhtml files when I ran the original plugin eg Section0001.xhtml. Was you referring to the Images\... reference in the listbox? The new version no longer shows Images\... |
![]() |
![]() |
![]() |
#11 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 27,798
Karma: 198099188
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
You're not doing anything wrong, it's just that the manifest ids of an epub's files won't always match what a user sees in Sigil's Book Browser. I included a "fix" for it in my patch. Perhaps you already applied it? EDIT: Yes, I see my patched code being used on line 139 Code:
for id, href in self.bk1.text_iter(): self.xhtmlTuple=self.xhtmlTuple + (os.path.basename(href),) Code:
for id, href in self.bk1.text_iter(): self.xhtmlTuple=self.xhtmlTuple + (id,) Last edited by DiapDealer; 02-11-2017 at 04:15 PM. |
|
![]() |
![]() |
![]() |
#12 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,980
Karma: 5449552
Join Date: Nov 2009
Device: many
|
The content.opf uses manifest ids. A manifest id is any unique identifier name. To make dure the id is unique, some people and somesofrware will copy the file name and use it as the manifest identifier. This is a simple way to assure uniqeness but can be confusing as both the actual filename based on the manifest href and the manifest id can look identical but need not be. That is why using the filenam part of the href is recommended as the id for that same manifest entry could be something like "c1" instead of "chapter1.xhtml".
Hope this explains things. KevinH |
![]() |
![]() |
![]() |
#13 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 27,798
Karma: 198099188
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Also, a heads-up to all that Python 3.6 absolutely detests tuples with null elements. For future compatibility, consider not using code like:
EDIT: never mind ... I remembered the issue wrong. The issue was empty/Null first elements in tuple that can cause problems in 3.6+. But only in freaky os.execvp() commands that you probably won't run into. Sorry for any confusion. Last edited by DiapDealer; 02-11-2017 at 04:33 PM. |
![]() |
![]() |
![]() |
#14 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 202
Karma: 62362
Join Date: Jul 2015
Device: Sony
|
@DiapDealer - Thanks for the supplying the bug fix - I had not realised that my original code populated the combobox with entries like "nav, toc" etc as my tests did not show this - all my IDs did match the filenames in my tests so I didnot detect this problem.
@KevinH - Thanks for the clarification. |
![]() |
![]() |
![]() |
#15 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 27,798
Karma: 198099188
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
No problem!
![]() |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Wrap in SVG plugin? | gezginrocker | Plugins | 18 | 07-05-2015 12:20 AM |
svg image on top of a background png image | roger64 | ePub | 25 | 04-24-2015 11:00 AM |
Display of a png image linked to a svg image | roger64 | Editor | 6 | 03-13-2015 06:21 AM |
Image wrap test | Jellby | ePub | 15 | 05-04-2011 02:30 PM |
Combining blockquote with image wrap | WRB | Sigil | 1 | 02-12-2011 07:46 PM |