2 Replies Latest reply on Feb 7, 2015 7:35 AM by rgb

    opening image through webserver

    annu_shah

      i have been told that if you put the files in the right folder and open the ip address of your galileo in your browser, you’ll see the files.

      can anyone guide me on this

        • 1. Re: opening image through webserver
          CMata_Intel

          Hi annu_shah

           

          I just tried this. First, create a new test.js file with this code:

          You need to change the X's with IPaddress of your board and  in /home/test/Capture.PNG the path of your image. If you are not using a .png image, you need to change the Content-Type': 'image/png' for the respective one.

          var http = require('http')
            , fs = require('fs');
          
          
          fs.readFile('/home/test/Capture.PNG', function(err, data) {
            if (err) throw err; 
            http.createServer(function(req, res) {
              res.writeHead(200, {'Content-Type': 'image/png'});
              res.end(data); 
            }).listen(81,'XXX.XXX.XX.XXX');
            console.log('Go to http://XXX.XXX.XX.XXX:81 and see the Capture.PNG');
          });
          

           

          Now, run the code with:

          root@clanton:~# node test.js
          

          And go to your browser and access to your IP address: XXX.XXX.XX.XXX:81

           

          Let me know if works for you

           

          Regards;

          CMata

          • 2. Re: opening image through webserver
            rgb

            Hi Annu_Shah

            Unlike the Arduino Yun, the Galileo doesn't have a web server running by default.

            As CMata mentioned you can create a web server using one of the programming languages - Node.js or Python, or you can install a web server.

            I outlined how you can install Flask, a Python based web server here

            https://communities.intel.com/message/270224#270224

            Since it is written in Python you can use the Wiring_x86 library from EmuTek and display information from sensors, pictures taken with a web cam and control the GPIO pins. See the example for WebLamp

            rgb