Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5936779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:26:48+00:00 2026-05-22T15:26:48+00:00

I want to have an image in a webpage that can be changed based

  • 0

I want to have an image in a webpage that can be changed based on the filepath stored in a file online (it doesn’t matter what typer of text file – xml, .txt – whatever works best).
So I basically want to have the page retrieve the text from that file, and then use that text as the source for an image in that page.
I’m assuming this is a Javascript thing, but it doesn’t matter to me, as long as it works.
Any ideas?
Thanks!!

**Edit: Forgot to mention: I’m using the code in a Google Chrome Extension, not sure that matters, as it uses regular HTML/Javascript, but it’s stored on the users computer, and I want the image to be stored on my server.

**Edit2:

Just got something that seems to work very well, and I only need this in the body part of the code:

      <script type="text/javascript" >
      var i=0;
      for (i=0;i<=FilePath.length - 1;i++)
      {
      document.write('<img src="' + FilePath[i] + '"/>');
      }
      </script>

Hope this is valid code, but it definitely seems to work here…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T15:26:48+00:00Added an answer on May 22, 2026 at 3:26 pm

    Its simple store the filepaths in a Javascript file , create an array in the JS file , and include all the filepaths in the array, then store the file on the webserver .

    Then after that you can retrieve it using

    <script src="JS_File_path_on_web_server" type="text/javascript" ></script>
    

    After you retrieve it , you can use Javascript , I prefer jQuery , to replace the src attribute on the Image with the one from the array .

    EDIT : Full version :

    //Javascript web server File
    var FilePath=new Array("Path1","Path2","Path3");
    

    Create a file like this and store as many paths as you want in the array .

    <html>
     <head>
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js">
      </script>
    
      <script src="JS_File_path_on_web_server" type="text/javascript" ></script>
    
      <script type="text/javascript" >
       $(document).ready(function()
       {
          $('#DisplayImage').attr('src',FilePath[0]);
       });
      </script>
      </head>
      <body>
            <img src="" id="DisplayImage" />
      </body>
    </html>
    

    This is a simple example , you can try learning javascript and Jquery to tweak it further .

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a webpage where I want the user to see a new image
I have image data and i want to get a sub image of that
I have: image 1:Many imageToTag Many:1 tag I want to issue a query that
I have a rootfs boot image that I want to test by mounting on
I am creating a web page, where I have an image that I want
I have images on a webpage that I want to have linked to another
I have an image and on it are logos (it's a map), I want
I have a JPEG image (actually a BLOB in a database) which I want
I have an object of the type System.Drawing.Image and want to make every pixel
I have a CALayer with some image contents. When a button touched, I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.