locked
Embed HDView in a Webpage ? RRS feed

  • Question

  • Hi,
    first of all, thanks a lot for this tool ! HDView is definitely a great software.

    Instead of linking visitors to a hdview webpage, I would like to embed HDView panoramas in my website (just like you embed a qtvr panorama or a youtube video), and I use a CMS (drupal) ; I tried to copy & paste the code (what was in the <body> </body> tags) from the html page generated by the Photoshop plugin in a webpage, and to put the rest (the folder & xml file generated) in a specific folder.
    Then, I tried to make the link between this folder and my webpage (since this is a CMS, pages are not static, so the html & xml/folder can't be in the same folder) :
    instead of

    Code Snippet

    <div id="hdvDiv" style="background-color: black; text-align: center;">
        <script type="text/javascript">
            var args;
            if ( top.location.search == "" )  {
                args = 'FileName=taj.xml&BackgroundColor=0';
            }
    [...]


    I wrote something like this :

    Code Snippet

    <div id="hdvDiv" style="background-color: black; text-align: center;">
        <script type="text/javascript">
            var args;
            if ( top.location.search == "" )  {
                args = 'FileName=http://www.site.com/folder/taj.xml&BackgroundColor=0';
            }
    [...]


    Where http://www.site.com/folder/ is the path of the files (folder/ xml file) generated by the plugin.

    Unfortunately, this doesn't seem to work ... I think HDView is still looking for a subfolder.
    Is there any way to solve this issue ?
    Tuesday, January 22, 2008 7:14 PM

Answers

  • Yes you can do this, but you'll have to edit the associated javascript file.

     

    If you've installed the hd view utilites, then you should see a C:\Program Files\HD View Utilities\Web on your machine.  in there is HDView2.js file. 

     

    Search for the following code in the SetPropety function

    Code Snippet
       if( prop == "FileName" ) {
        curFilename = val;
        var pageArgs = argHref.split('?');
        var pagePath = pageArgs[0].substring(0, pageArgs[0].lastIndexOf('/') + 1);
        val = pagePath + val;
       }

     

     

    And change it to this

    Code Snippet
       if( prop == "FileName" ) {
        curFilename = val;
       }

     

    Then change <script type="text/javascript" src="http://research.microsoft.com/ivm/HDView/HDView2.js"></script>
    in your htm file and point it to your edited js. 

     

    Note if you keep the 'save specific view' functionality on your page then you may want to make further chnages to the javascript to prevent xmls from arbitrary domains being loaded through this mechanism.  This is why we forced the FileName to be relative.


     


    Wednesday, January 23, 2008 5:22 AM

All replies

  • Yes you can do this, but you'll have to edit the associated javascript file.

     

    If you've installed the hd view utilites, then you should see a C:\Program Files\HD View Utilities\Web on your machine.  in there is HDView2.js file. 

     

    Search for the following code in the SetPropety function

    Code Snippet
       if( prop == "FileName" ) {
        curFilename = val;
        var pageArgs = argHref.split('?');
        var pagePath = pageArgs[0].substring(0, pageArgs[0].lastIndexOf('/') + 1);
        val = pagePath + val;
       }

     

     

    And change it to this

    Code Snippet
       if( prop == "FileName" ) {
        curFilename = val;
       }

     

    Then change <script type="text/javascript" src="http://research.microsoft.com/ivm/HDView/HDView2.js"></script>
    in your htm file and point it to your edited js. 

     

    Note if you keep the 'save specific view' functionality on your page then you may want to make further chnages to the javascript to prevent xmls from arbitrary domains being loaded through this mechanism.  This is why we forced the FileName to be relative.


     


    Wednesday, January 23, 2008 5:22 AM
  • Thanks a lot for your quick help !

    I will try this asap.

    Wednesday, January 23, 2008 10:43 PM