Loading ...
Sorry, an error occurred while loading the content.
 

Accessing the loaded Image from Javascript

Expand Messages
  • sun2tzu2005
    hi all, My system setup: OS: Win2000 Advanced IE=5.5 ASV3 Dynamic SVG being generated at runtime using cocoon-2.1.2. Using Javascript to handle the rest. I am
    Message 1 of 5 , Mar 7, 2004
      hi all,
      My system setup:
      OS: Win2000 Advanced
      IE=5.5
      ASV3
      Dynamic SVG being generated at runtime using cocoon-2.1.2.
      Using Javascript to handle the rest.

      I am using the SVG Image tag to load a JPEG image from a remote url.
      <svg:image x=0 y=0 width=560 height=560 xlink:href="..."/>.For the
      loading purpose , i set the x,y,width,height properties to some
      default values as shown.
      But my need is to find the image aspect ratio based on the actual
      width and height properties of the image.In Javascript there is way
      in which you can use a Image class to get the image.width and height
      properties.Given the image width/height ratio i can then set the
      image tag to the x,y,width,height later and thus not show a distorted
      raster image in the background to the user,as he would using that
      displayed image as a reference to plot points on the svg.
      Is there any way to access the image which was loaded by ASV3
      running on IE5.5.The DOM SVGImageElement just gives me the properties
      that were defined in the tag,which doesn't help me much.
      I hope someone can help me out with these.
      regards
      SUN
    • Mathias FATENE
      Hi, ... Resize an embeded Image to its REAL size via Javascript (IE) Dr. Mathias FATENE var myImage = new
      Message 2 of 5 , Mar 7, 2004
        Hi,
        I give you a funny code i developped for IE and Image properties :
        ----------------------------------------------------------------------------
        ---------
        <svg onload="init(evt)">
        <desc>
        Resize an embeded Image to its REAL size via Javascript (IE)
        Dr. Mathias FATENE
        </desc>
        <script>
        var myImage = new Image;
        myImage.src = "122809.gif";
        function init(evt) {
        svgdoc=evt.target.ownerDocument()
        alert(myImage.width+"x"+myImage.height)
        svgdoc.getElementById("MyResizedImg").setAttribute("width",myImage.width)
        svgdoc.getElementById("MyResizedImg").setAttribute("height",myImage.height)
        }

        </script>

        <image id="MyResizedImg" x="0" y="0" width="300" height="300"
        xlink:href="122809.gif"/>
        </svg>
        ----------------------------------------------------------------------------
        ---------

        Mathias

        -----Original Message-----
        From: sun2tzu2005 [mailto:sun2tzu2005@...]
        Sent: Sunday, March 07, 2004 5:15 PM
        To: svg-developers@yahoogroups.com
        Subject: [svg-developers] Accessing the loaded Image from Javascript


        hi all,
        My system setup:
        OS: Win2000 Advanced
        IE=5.5
        ASV3
        Dynamic SVG being generated at runtime using cocoon-2.1.2.
        Using Javascript to handle the rest.

        I am using the SVG Image tag to load a JPEG image from a remote url.
        <svg:image x=0 y=0 width=560 height=560 xlink:href="..."/>.For the
        loading purpose , i set the x,y,width,height properties to some
        default values as shown.
        But my need is to find the image aspect ratio based on the actual
        width and height properties of the image.In Javascript there is way
        in which you can use a Image class to get the image.width and height
        properties.Given the image width/height ratio i can then set the
        image tag to the x,y,width,height later and thus not show a distorted
        raster image in the background to the user,as he would using that
        displayed image as a reference to plot points on the svg.
        Is there any way to access the image which was loaded by ASV3
        running on IE5.5.The DOM SVGImageElement just gives me the properties
        that were defined in the tag,which doesn't help me much.
        I hope someone can help me out with these.
        regards
        SUN




        -----
        To unsubscribe send a message to: svg-developers-unsubscribe@yahoogroups.com
        -or-
        visit http://groups.yahoo.com/group/svg-developers and click "edit my
        membership"
        ----
        Yahoo! Groups Links
      • sun2tzu2005
        hi Mathias, Thanks for the the code.I tried that logic,but since my embedded images are being fetched over a remote URL and not from a local directory and the
        Message 3 of 5 , Mar 7, 2004
          hi Mathias,
          Thanks for the the code.I tried that logic,but since my embedded
          images are being fetched over a remote URL and not from a local
          directory and the Image.src member doesnot support urls,so i am
          looking for a different way to get at it.
          thanks again.
          regards
          SUN

          --- In svg-developers@yahoogroups.com, "Mathias FATENE"
          <mathias.fatene@w...> wrote:
          > Hi,
          > I give you a funny code i developped for IE and Image properties :
          > --------------------------------------------------------------------
          --------
          > ---------
          > <svg onload="init(evt)">
          > <desc>
          > Resize an embeded Image to its REAL size via Javascript (IE)
          > Dr. Mathias FATENE
          > </desc>
          > <script>
          > var myImage = new Image;
          > myImage.src = "122809.gif";
          > function init(evt) {
          > svgdoc=evt.target.ownerDocument()
          > alert(myImage.width+"x"+myImage.height)
          > svgdoc.getElementById("MyResizedImg").setAttribute
          ("width",myImage.width)
          > svgdoc.getElementById("MyResizedImg").setAttribute
          ("height",myImage.height)
          > }
          >
          > </script>
          >
          > <image id="MyResizedImg" x="0" y="0" width="300" height="300"
          > xlink:href="122809.gif"/>
          > </svg>
          > --------------------------------------------------------------------
          --------
          > ---------
          >
          > Mathias
          >
          > -----Original Message-----
          > From: sun2tzu2005 [mailto:sun2tzu2005@y...]
          > Sent: Sunday, March 07, 2004 5:15 PM
          > To: svg-developers@yahoogroups.com
          > Subject: [svg-developers] Accessing the loaded Image from Javascript
          >
          >
          > hi all,
          > My system setup:
          > OS: Win2000 Advanced
          > IE=5.5
          > ASV3
          > Dynamic SVG being generated at runtime using cocoon-2.1.2.
          > Using Javascript to handle the rest.
          >
          > I am using the SVG Image tag to load a JPEG image from a remote
          url.
          > <svg:image x=0 y=0 width=560 height=560 xlink:href="..."/>.For the
          > loading purpose , i set the x,y,width,height properties to some
          > default values as shown.
          > But my need is to find the image aspect ratio based on the actual
          > width and height properties of the image.In Javascript there is way
          > in which you can use a Image class to get the image.width and height
          > properties.Given the image width/height ratio i can then set the
          > image tag to the x,y,width,height later and thus not show a
          distorted
          > raster image in the background to the user,as he would using that
          > displayed image as a reference to plot points on the svg.
          > Is there any way to access the image which was loaded by ASV3
          > running on IE5.5.The DOM SVGImageElement just gives me the
          properties
          > that were defined in the tag,which doesn't help me much.
          > I hope someone can help me out with these.
          > regards
          > SUN
          >
          >
          >
          >
          > -----
          > To unsubscribe send a message to: svg-developers-
          unsubscribe@yahoogroups.com
          > -or-
          > visit http://groups.yahoo.com/group/svg-developers and click "edit
          my
          > membership"
          > ----
          > Yahoo! Groups Links
        • Mathias FATENE
          Hi, The différent way to do it is to play my svg+JS code on the server, and embed and svg file for each image using getURL and parseXML. Mathias ... From:
          Message 4 of 5 , Mar 7, 2004
            Hi,
            The différent way to do it is to play my svg+JS code on the server, and
            embed and svg file for each image using getURL and parseXML.

            Mathias

            -----Original Message-----
            From: sun2tzu2005 [mailto:sun2tzu2005@...]
            Sent: Sunday, March 07, 2004 7:20 PM
            To: svg-developers@yahoogroups.com
            Subject: [svg-developers] Re: Accessing the loaded Image from Javascript


            hi Mathias,
            Thanks for the the code.I tried that logic,but since my embedded
            images are being fetched over a remote URL and not from a local
            directory and the Image.src member doesnot support urls,so i am
            looking for a different way to get at it.
            thanks again.
            regards
            SUN

            --- In svg-developers@yahoogroups.com, "Mathias FATENE"
            <mathias.fatene@w...> wrote:
            > Hi,
            > I give you a funny code i developped for IE and Image properties :
            > --------------------------------------------------------------------
            --------
            > ---------
            > <svg onload="init(evt)">
            > <desc>
            > Resize an embeded Image to its REAL size via Javascript (IE)
            > Dr. Mathias FATENE
            > </desc>
            > <script>
            > var myImage = new Image;
            > myImage.src = "122809.gif";
            > function init(evt) {
            > svgdoc=evt.target.ownerDocument()
            > alert(myImage.width+"x"+myImage.height)
            > svgdoc.getElementById("MyResizedImg").setAttribute
            ("width",myImage.width)
            > svgdoc.getElementById("MyResizedImg").setAttribute
            ("height",myImage.height)
            > }
            >
            > </script>
            >
            > <image id="MyResizedImg" x="0" y="0" width="300" height="300"
            > xlink:href="122809.gif"/>
            > </svg>
            > --------------------------------------------------------------------
            --------
            > ---------
            >
            > Mathias
            >
            > -----Original Message-----
            > From: sun2tzu2005 [mailto:sun2tzu2005@y...]
            > Sent: Sunday, March 07, 2004 5:15 PM
            > To: svg-developers@yahoogroups.com
            > Subject: [svg-developers] Accessing the loaded Image from Javascript
            >
            >
            > hi all,
            > My system setup:
            > OS: Win2000 Advanced
            > IE=5.5
            > ASV3
            > Dynamic SVG being generated at runtime using cocoon-2.1.2.
            > Using Javascript to handle the rest.
            >
            > I am using the SVG Image tag to load a JPEG image from a remote
            url.
            > <svg:image x=0 y=0 width=560 height=560 xlink:href="..."/>.For the
            > loading purpose , i set the x,y,width,height properties to some
            > default values as shown.
            > But my need is to find the image aspect ratio based on the actual
            > width and height properties of the image.In Javascript there is way
            > in which you can use a Image class to get the image.width and height
            > properties.Given the image width/height ratio i can then set the
            > image tag to the x,y,width,height later and thus not show a
            distorted
            > raster image in the background to the user,as he would using that
            > displayed image as a reference to plot points on the svg.
            > Is there any way to access the image which was loaded by ASV3
            > running on IE5.5.The DOM SVGImageElement just gives me the
            properties
            > that were defined in the tag,which doesn't help me much.
            > I hope someone can help me out with these.
            > regards
            > SUN
            >
            >
            >
            >
            > -----
            > To unsubscribe send a message to: svg-developers-
            unsubscribe@yahoogroups.com
            > -or-
            > visit http://groups.yahoo.com/group/svg-developers and click "edit
            my
            > membership"
            > ----
            > Yahoo! Groups Links




            -----
            To unsubscribe send a message to: svg-developers-unsubscribe@yahoogroups.com
            -or-
            visit http://groups.yahoo.com/group/svg-developers and click "edit my
            membership"
            ----
            Yahoo! Groups Links
          • Mathias FATENE
            The other way is base64 embeding if you don t want absolutely values of width and height Mathias ... From: Mathias FATENE [mailto:mathias.fatene@wanadoo.fr]
            Message 5 of 5 , Mar 7, 2004
              The other way is base64 embeding if you don't want absolutely values of
              width and height

              Mathias

              -----Original Message-----
              From: Mathias FATENE [mailto:mathias.fatene@...]
              Sent: Sunday, March 07, 2004 7:33 PM
              To: svg-developers@yahoogroups.com
              Subject: RE: [svg-developers] Re: Accessing the loaded Image from
              Javascript


              Hi,
              The différent way to do it is to play my svg+JS code on the server, and
              embed and svg file for each image using getURL and parseXML.

              Mathias

              -----Original Message-----
              From: sun2tzu2005 [mailto:sun2tzu2005@...]
              Sent: Sunday, March 07, 2004 7:20 PM
              To: svg-developers@yahoogroups.com
              Subject: [svg-developers] Re: Accessing the loaded Image from Javascript


              hi Mathias,
              Thanks for the the code.I tried that logic,but since my embedded
              images are being fetched over a remote URL and not from a local
              directory and the Image.src member doesnot support urls,so i am
              looking for a different way to get at it.
              thanks again.
              regards
              SUN

              --- In svg-developers@yahoogroups.com, "Mathias FATENE"
              <mathias.fatene@w...> wrote:
              > Hi,
              > I give you a funny code i developped for IE and Image properties :
              > --------------------------------------------------------------------
              --------
              > ---------
              > <svg onload="init(evt)">
              > <desc>
              > Resize an embeded Image to its REAL size via Javascript (IE)
              > Dr. Mathias FATENE
              > </desc>
              > <script>
              > var myImage = new Image;
              > myImage.src = "122809.gif";
              > function init(evt) {
              > svgdoc=evt.target.ownerDocument()
              > alert(myImage.width+"x"+myImage.height)
              > svgdoc.getElementById("MyResizedImg").setAttribute
              ("width",myImage.width)
              > svgdoc.getElementById("MyResizedImg").setAttribute
              ("height",myImage.height)
              > }
              >
              > </script>
              >
              > <image id="MyResizedImg" x="0" y="0" width="300" height="300"
              > xlink:href="122809.gif"/>
              > </svg>
              > --------------------------------------------------------------------
              --------
              > ---------
              >
              > Mathias
              >
              > -----Original Message-----
              > From: sun2tzu2005 [mailto:sun2tzu2005@y...]
              > Sent: Sunday, March 07, 2004 5:15 PM
              > To: svg-developers@yahoogroups.com
              > Subject: [svg-developers] Accessing the loaded Image from Javascript
              >
              >
              > hi all,
              > My system setup:
              > OS: Win2000 Advanced
              > IE=5.5
              > ASV3
              > Dynamic SVG being generated at runtime using cocoon-2.1.2.
              > Using Javascript to handle the rest.
              >
              > I am using the SVG Image tag to load a JPEG image from a remote
              url.
              > <svg:image x=0 y=0 width=560 height=560 xlink:href="..."/>.For the
              > loading purpose , i set the x,y,width,height properties to some
              > default values as shown.
              > But my need is to find the image aspect ratio based on the actual
              > width and height properties of the image.In Javascript there is way
              > in which you can use a Image class to get the image.width and height
              > properties.Given the image width/height ratio i can then set the
              > image tag to the x,y,width,height later and thus not show a
              distorted
              > raster image in the background to the user,as he would using that
              > displayed image as a reference to plot points on the svg.
              > Is there any way to access the image which was loaded by ASV3
              > running on IE5.5.The DOM SVGImageElement just gives me the
              properties
              > that were defined in the tag,which doesn't help me much.
              > I hope someone can help me out with these.
              > regards
              > SUN
              >
              >
              >
              >
              > -----
              > To unsubscribe send a message to: svg-developers-
              unsubscribe@yahoogroups.com
              > -or-
              > visit http://groups.yahoo.com/group/svg-developers and click "edit
              my
              > membership"
              > ----
              > Yahoo! Groups Links




              -----
              To unsubscribe send a message to: svg-developers-unsubscribe@yahoogroups.com
              -or-
              visit http://groups.yahoo.com/group/svg-developers and click "edit my
              membership"
              ----
              Yahoo! Groups Links







              -----
              To unsubscribe send a message to: svg-developers-unsubscribe@yahoogroups.com
              -or-
              visit http://groups.yahoo.com/group/svg-developers and click "edit my
              membership"
              ----
              Yahoo! Groups Links
            Your message has been successfully submitted and would be delivered to recipients shortly.