Hi HardCoder,

hardc0d3r <[EMAIL PROTECTED]> wrote on 05/11/2007 12:06:32 PM:

> from what i understand, if my image is in the same folder as my program, 
i
> only need to specify the filename.

   I don't know why you would think that.  Your images need to
be in the same folder as the document you are adding the image
elements to.  If your document is created entirely on the fly
then it probably doesn't have a 'base URL'.  You can associate
one by calling batik.dom.svg.SVGOMDocument.setURLObject(URL).

 but i get a null pointer exception.. i am
> sure that the image and the program is on the same folder.. here is the
> code:
> 
> private void loadImage() {
>        try {
>           SVGDocument doc = svgCanvas.getSVGDocument();
> 
>             Element mapLayer = doc.createElementNS(svgNS, "image");
>             imageLayer.setAttributeNS(null, "x", "0");
>             imageLayer.setAttributeNS(null, "y", "0");
>             imageLayer.setAttributeNS(null, "width", "260");
>             imageLayer.setAttributeNS(null, "height", "368");
>             imageLayer.setAttributeNS(XLINK_NAMESPACE_URI, "xlink:href",
> "test.jpg");
> 
>             svgRoot.appendChild(imageLayer);
> 
>        } catch(Exception e) {
>           System.out.println(e.toString());
>        }
>     }
> 
> are ther any errors on the code?
> -- 
> View this message in context: http://www.nabble.com/Error-importing-
> Images-into-an-image-tag--tf646195.html#a10434915
> Sent from the Batik - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to