Obtaining the image path from a relative URI using JavaScript and API user data












0















I am sorry but this will probably not be very clear as I am becoming quite bogged down with this issue.
I am trying to initialise a hover effect and produce this effect on an iFrame which is created via a node app and is added as a widget on a web page. The settings such as images are delivered to the iFrame from the app at runtime.



So I have an HTML document for my iFrame where I create an empty div:



    <div id="myDiv" class="display-class">


Then I have my JavaScript file where I wish to initialise my effect with:



    new myEffect({
parent: document.querySelector('.display-class'),
intensity: 0.1,
speedIn: 0.6,
image0:settings.image0,
image1:settings.image1,
displacementImage: 'src/images/middleImg.png'


settings.image0 and settings.image1 both produce information like this:



    Array(1)
0:
fileName: "filename"
height: "2755"
relativeUri: "c7765ce2ddf3420e84f10add413364dc.jpg"
width: "3441"
__proto__: Object
length: 1
__proto__: Array(0)


The effect can be created by using absolute image paths with no issues, for example:



    'src/images/image0.png'
'src/images/image1.png'


However I need to be able to set the images which have been selected by the user.



I have tried to access the relativeUris using array notation such as



   image[0].relativeUri 
image1[0].relativeUri


- as I have two images I have to get to display the effect.
The other image which produces the transition between the images is stored as an absolute path so this is found with no issues.



I'm sorry this is so vague, but I'm really confused.
Edit - I meant to say when I use the notation:



    image[0].relativeUri


Or a variant of it, the relativeUri is shown as being the image path - but still no image displays.










share|improve this question





























    0















    I am sorry but this will probably not be very clear as I am becoming quite bogged down with this issue.
    I am trying to initialise a hover effect and produce this effect on an iFrame which is created via a node app and is added as a widget on a web page. The settings such as images are delivered to the iFrame from the app at runtime.



    So I have an HTML document for my iFrame where I create an empty div:



        <div id="myDiv" class="display-class">


    Then I have my JavaScript file where I wish to initialise my effect with:



        new myEffect({
    parent: document.querySelector('.display-class'),
    intensity: 0.1,
    speedIn: 0.6,
    image0:settings.image0,
    image1:settings.image1,
    displacementImage: 'src/images/middleImg.png'


    settings.image0 and settings.image1 both produce information like this:



        Array(1)
    0:
    fileName: "filename"
    height: "2755"
    relativeUri: "c7765ce2ddf3420e84f10add413364dc.jpg"
    width: "3441"
    __proto__: Object
    length: 1
    __proto__: Array(0)


    The effect can be created by using absolute image paths with no issues, for example:



        'src/images/image0.png'
    'src/images/image1.png'


    However I need to be able to set the images which have been selected by the user.



    I have tried to access the relativeUris using array notation such as



       image[0].relativeUri 
    image1[0].relativeUri


    - as I have two images I have to get to display the effect.
    The other image which produces the transition between the images is stored as an absolute path so this is found with no issues.



    I'm sorry this is so vague, but I'm really confused.
    Edit - I meant to say when I use the notation:



        image[0].relativeUri


    Or a variant of it, the relativeUri is shown as being the image path - but still no image displays.










    share|improve this question



























      0












      0








      0








      I am sorry but this will probably not be very clear as I am becoming quite bogged down with this issue.
      I am trying to initialise a hover effect and produce this effect on an iFrame which is created via a node app and is added as a widget on a web page. The settings such as images are delivered to the iFrame from the app at runtime.



      So I have an HTML document for my iFrame where I create an empty div:



          <div id="myDiv" class="display-class">


      Then I have my JavaScript file where I wish to initialise my effect with:



          new myEffect({
      parent: document.querySelector('.display-class'),
      intensity: 0.1,
      speedIn: 0.6,
      image0:settings.image0,
      image1:settings.image1,
      displacementImage: 'src/images/middleImg.png'


      settings.image0 and settings.image1 both produce information like this:



          Array(1)
      0:
      fileName: "filename"
      height: "2755"
      relativeUri: "c7765ce2ddf3420e84f10add413364dc.jpg"
      width: "3441"
      __proto__: Object
      length: 1
      __proto__: Array(0)


      The effect can be created by using absolute image paths with no issues, for example:



          'src/images/image0.png'
      'src/images/image1.png'


      However I need to be able to set the images which have been selected by the user.



      I have tried to access the relativeUris using array notation such as



         image[0].relativeUri 
      image1[0].relativeUri


      - as I have two images I have to get to display the effect.
      The other image which produces the transition between the images is stored as an absolute path so this is found with no issues.



      I'm sorry this is so vague, but I'm really confused.
      Edit - I meant to say when I use the notation:



          image[0].relativeUri


      Or a variant of it, the relativeUri is shown as being the image path - but still no image displays.










      share|improve this question
















      I am sorry but this will probably not be very clear as I am becoming quite bogged down with this issue.
      I am trying to initialise a hover effect and produce this effect on an iFrame which is created via a node app and is added as a widget on a web page. The settings such as images are delivered to the iFrame from the app at runtime.



      So I have an HTML document for my iFrame where I create an empty div:



          <div id="myDiv" class="display-class">


      Then I have my JavaScript file where I wish to initialise my effect with:



          new myEffect({
      parent: document.querySelector('.display-class'),
      intensity: 0.1,
      speedIn: 0.6,
      image0:settings.image0,
      image1:settings.image1,
      displacementImage: 'src/images/middleImg.png'


      settings.image0 and settings.image1 both produce information like this:



          Array(1)
      0:
      fileName: "filename"
      height: "2755"
      relativeUri: "c7765ce2ddf3420e84f10add413364dc.jpg"
      width: "3441"
      __proto__: Object
      length: 1
      __proto__: Array(0)


      The effect can be created by using absolute image paths with no issues, for example:



          'src/images/image0.png'
      'src/images/image1.png'


      However I need to be able to set the images which have been selected by the user.



      I have tried to access the relativeUris using array notation such as



         image[0].relativeUri 
      image1[0].relativeUri


      - as I have two images I have to get to display the effect.
      The other image which produces the transition between the images is stored as an absolute path so this is found with no issues.



      I'm sorry this is so vague, but I'm really confused.
      Edit - I meant to say when I use the notation:



          image[0].relativeUri


      Or a variant of it, the relativeUri is shown as being the image path - but still no image displays.







      javascript html






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 24 '18 at 9:44







      Monette G

















      asked Nov 23 '18 at 23:28









      Monette GMonette G

      613




      613
























          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53453857%2fobtaining-the-image-path-from-a-relative-uri-using-javascript-and-api-user-data%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53453857%2fobtaining-the-image-path-from-a-relative-uri-using-javascript-and-api-user-data%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Costa Masnaga

          Fotorealismo

          Sidney Franklin