3 Replies Latest reply: Feb 26, 2013 11:28 AM by RickG RSS

    RESTful services and images

    user12083950
      Hi

      How to upload images on Oracle cloud host and use it with RESTful pl/sql
      For example following generate web page and display picture from Oracle web site
      BEGIN
      sys.htp.htmlopen;
      sys.htp.headopen;
      sys.htp.title('Title');
      sys.htp.headclose;
      sys.htp.bodyopen;
      sys.htp.print('Hello World');
      htp.p('<img src="http://www.oracle.com/us/hp01-thumb-bobevans-1896147.jpg" >');
      sys.htp.bodyclose;
      sys.htp.htmlclose;
      END;

      How to copy hp01-thumb-bobevans-1896147.jpg image on https://database-trialXXXX.db.us1.oraclecloudapps.com?
      and refer to it as
      htp.p('<img src="https://database-trialXXXX.db.us1.oraclecloudapps.com/pics/hp01-thumb-bobevans-1896147.jpg" >');

      Thanks
      Leon
        • 1. Re: RESTful services and images
          RickG
          Leon -

          If I follow your question, you are asking how to retrieve images with RESTful Web Services. It looks like your code assumes that RESTful Web Services have access to an underlying directory in the Cloud. This is not correct - Database Cloud users have no access to a file system. Instead, you would store your images in the database and use the Media Resource source type to return a .jpg without any translation or marshalling by the RESTful handler.

          Hope this helps.

          - Rick Greenwald
          • 2. Re: RESTful services and images
            user12083950
            Hi Rick

            Could you please provide pl/sql and/or HTML example of an image tag referring to picture saved in user table?



            Thanks
            Leon
            • 3. Re: RESTful services and images
              RickG
              Hi Leon -

              I have not tested this, but I think you would create a RESTful Web Service call with a source of Media Resource, and then use that call as the img tag. Hope this helps.

              - Rick Greenwald