Menu

#1 Allow FlickrViewer to work with absolute URLs

open
nobody
None
5
2008-08-06
2008-08-06
No

Currently, when FlickrViewer sends the URL of an image to SimpleViewer, it uses the following relative path:

imagePath="flickrViewer.php?mode=img&size=large&image="

However, on a site that rewrites its URLs (ex. wordpress or expression engine), SimpleViewer and FlickrViewer may be called absolutely (ex. http://www.example.com/dir/viewer.swf\), so the relative call to the php file would not work.

To fix this, I propose that FlickrViewer take a parameter called 'site_url'. For example:

In the JS call:
so.addVariable("xmlDataPath", "http://www.example.com/dir/flickrViewer.php?site_url=http://www.example.com/dir/");

In FlickrViewer.php:
$site_url = $_GET['site_url'];
...
imagePath="'.$site_url.'flickrViewer.php?mode=img&size=large&image=" thumbPath="'.$site_url.'flickrViewer.php?mode=img&size=thumb&image="

As far as I see, this is backwards compatible. (ie. users that don't use the parameter, have no problems, even after an upgrade).

(Note: a better alternative may be to get the site_url from the request URL)

Discussion


Log in to post a comment.

MongoDB Logo MongoDB