Topic: CDN Issue

Speed tests show that my images are not being pulled by my CDN due to the fact that the XML file is showing the original server rather than the CDN. How do I configure Juicebox to pull the correct images from my CDN? I'd rather have it done automatically but if I have to, I'm willing to edit the PHP code in config.php to get the generated XML file to pull the correct URLs.

My webhost automatically rewrites the URLs in the HTML that link to a JPG file but when I review the source code from the gallery page, there are no JPG URLs so none of the URLs are getting rewritten to pull from the CDN. Another option would be to have the config.php file write the URLs into the HTML file instead of loading a separate XML file.

I just need a way to get Juicebox to correctly pull the JPGs from my CDN so please advice which way would be best. Thanks.

Re: CDN Issue

I tried to use baseUrl and add the code directly into a Wordpress page but it didn't work. The XML contained the baseUrl but all the URLs were still written with my original server and not the baseUrl. I even tried to copy and paste the XML file and rewrite all of the URLs but then I could no longer access the gallery in Wordpress. Please tell me there's an easy solution to using Juicebox with a CDN.

Re: CDN Issue

Can you provide a URL of your gallery so we can take a look at?

Re: CDN Issue

I came to the realization that the wordpress plugin would never work so I ended up using the app to build the gallery and create the XML file. I used baseUrl and was able to access the gallery from the CDN but only when I use this address...

http://cdn.samchyung.com/wedding_portfolio/

which defeats the purpose since I want to use it at http://www.samchyung.com/wedding_portfolio/

but that results in an XML error. How do I get it so I can call the gallery from my website but have the images pulled from the CDN?

Re: CDN Issue

Ok. I think I figured it out. By adding an additional line to the embed to the XML path on my Original Server, I was able to get around the XML error and since the baseUrl is still pointed to the CDN, I think the images are being pulled from my CDN.

Re: CDN Issue

BTW, why does Juicebox fail to load if the XML URL comes from the CDN? I'd like to use the URL from the CDN since it's faster than my main server.

Re: CDN Issue

Javascript does not allow you to load XML files cross domain for security reasons.

For future reference here is the solution to load images from a different domain.

To host a gallery at: www.example.com/gallery/ and pull images from www.cdn.com/gallery/, do this:

1) Upload gallery folder to both www.example.com/gallery/ and www.cdn.com/gallery/
2) Edit embed code on www.example.com/gallery/index.html to look like this:

<!--START JUICEBOX EMBED-->
<script src="www.cdn.com/gallery/jbcore/juicebox.js"></script>
<script>
    new juicebox({
        containerId : 'juicebox-container',
        configUrl : 'www.example.com/gallery/config.xml',
        baseUrl : 'www.cdn.com/gallery/',
        galleryWidth: '100%',
        galleryHeight: '100%',
        backgroundColor: 'rgba(255,255,255,1)'
    });
</script>
<div id="juicebox-container"></div>
<!--END JUICEBOX EMBED-->

This will load everything except the XML file from the CDN domain.