[jsword-devel] JSword now handles images

Troy A. Griffitts scribe at crosswire.org
Thu Oct 5 15:26:08 MST 2006


DM,

This is cool!  Great work!  I hope we can soon release some useful 
modules which include images.

It seems odd that sword forces a '/' at the start of the image name?  I 
would have not programmed it that way on purpose.  Having said that, 
practically I would have intended things to effectively work the same 
way-- all image location paths have a root of the sword module datapath. 
  Though when creating a module, I would prefer not to use a preceding 
'/' (e.g., I would rather use src="images/pic.jpg").  If the C++ lib is 
not coded this way, I will log a bug and change things to allow one to 
not include the preceding '/'  (i.e., including or excluding the '/' 
makes no difference).

	-Troy.



DM Smith wrote:
> I have added support for images to JSword. Both ThML <img> and OSIS  
> <figure> are supported.
> 
> It is expected that the src attribute of these tags uses a reference  
> from the root directory where the module is held. If the images are  
> in an images subdirectory, say for the KJV, then you might see  
> <figure src="/images/pic.jpg"/> in OSIS or <img src="/images/pic.jpg"/ 
>  > in ThML. SWORD requires them to be preceded with / as if each  
> module was a separate web server/application.
> 
> In making this change, I made the location of the directory  
> containing mods.d and modules a URL attribute of BookMetaData. For  
> lack of a better name I named this location the "Library" since it  
> houses one or more books. Also, in the same fashion, I added another  
> URL attribute to BookMetaData to represent the root location of the  
> files for a module and called it "Location" for lack of a better  
> name. It is this to which relative references refer.
> 
> This information used to be held by  
> org.crosswire.jsword.sword.AbstractBackend. So it has been moved from  
> there. While this was a big checkin, it simplified the code.
> 
> Unfortunately for BibleDesktop, the HTML renderer does not understand  
> <base href="baseurl"/>. So each crafted <img> tag needs to have the  
> image path assembled.
> 
> If your target is a real browser, using base is preferred. But, since  
> SWORD modules use absolute references, you will need to remove the  
> leading '/' when crafting the src attribute of the <img> tag.
> 
> I mentioned that these locations are URLs. This will allow for remote  
> modules in the future.
> 
> In His Service,
> 	DM
> 
> _______________________________________________
> jsword-devel mailing list
> jsword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/jsword-devel




More information about the jsword-devel mailing list