Shop OBEX P1 Docs P2 Docs Learn Events
Accessing other files on the SD card for a webpage — Parallax Forums

Accessing other files on the SD card for a webpage

deanwesterburgdeanwesterburg Posts: 25
edited 2012-03-21 13:19 in Accessories
I am currently using the example code from Spinneret_Micro_SD_Card_WebPage_01_-_Archive__Date_2011.12.31__Time_14.40

Is there a way to include images on the SD card and have the web page access it as a relative link?

Example:
On the SD Card: spinner.txt (Basically the default webpage)
logo.jpg

<html><body><center><imgsrc = /logo.jpg></center></body></html>

Thanks!

Comments

  • Mike GMike G Posts: 2,702
    edited 2012-03-21 05:51
    Images on a page are just another socket request. When the browser sees an image request in the HTML, relative or absolute, the browser will request the image from the server. The browser might open several connections to at once to retrieve an entire requested page.

    Keep in mind that the Spinneret has 4 hardware sockets. The code base you are using might only use one socket.

    Have you tried to add an image to the page?

    This code will render page resources.
    Tutorial
    http://spinneret.servebeer.com:5000/index.htm

    Downloads
    http://spinneret.servebeer.com:5000/downl.htm
  • Mike GMike G Posts: 2,702
    edited 2012-03-21 07:11
    After a re-read I think you're asking how write an HTML img tag...
    <img src="logo.jpg" alt="Logo" />
    

    W3Schools has wonderful HTML tutorials.
    http://www.w3schools.com/html/html_images.asp
  • deanwesterburgdeanwesterburg Posts: 25
    edited 2012-03-21 08:09
    I am familure with HTML and how the process works, however, the example loads the entire spinner.txt (What would nornaly be index.htm or default.html) into a string variable (@TEXT) and loads it. No where does it specify that the SD card is the "Root" of the website data as it would in IIS. Is this assumed?

    for example in IIS or in Apache, your document root is set and might be something like "/srv/https/siteroot". if you reference an image or other object via relative path on the page it assumes that it will be in that root ("/srv/https/siteroot") (or c:\inetpub\wwroot if your a windows guy)

    I checked the tutorial site you mentioned, however, all the links are dead. Looks like it would be a great resource for several of the things I want to do! I'll try to download the code from the second link and work with it later this week.

    Thanks!
  • Mike GMike G Posts: 2,702
    edited 2012-03-21 13:19
    I am familure with HTML and how the process works, however, the example loads the entire spinner.txt (What would nornaly be index.htm or default.html) into a string variable (@TEXT) and loads it. No where does it specify that the SD card is the "Root" of the website data as it would in IIS. Is this assumed?
    Page and root defaults are setup in the request object and are configurable.
Sign In or Register to comment.