Topic: Dynamic Images

I'm trying to integrate SimpleView with my site that uses dynamic images (e.g. /image.php?id=1 vs /image.jpg).  The dynamic image script outputs a valid, jpeg image.  The SimpleView script doesn't seem to like the dynamic image script though.  If I save the image as a static image, then change the xml file, then it works fine, but using the dynamic script just shows blank image spots.

Any advice?  Is it even possible to use a dynamic image script with SimpleView?

Thanks

Re: Dynamic Images

If you want dynamic images, the recommended way is to use a dynamic XML file that points to static images. Check here for details: http://www.airtightinteractive.com/simp … omize.html

Felix Turner
SimpleViewer Support Team.

Re: Dynamic Images

Thanks for the reply,

I'm actually trying to integrate simpleviewer into Gallery, which shows resized and cropped images via a php script.  So I'm already using a dynamic xml script to list the images, but unfortunately, there are no static images.

How does the script determine if the file is in the acceptable format? Does it just look at the file extention, or does it determin the actual mime type?

Thanks

Re: Dynamic Images

there is no check on the file name or mime type, so it should work. Do you have an image and a thumbnail for each image?

Felix Turner
SimpleViewer Support Team.

Re: Dynamic Images

I am using the same image as the image and thumbnail, by setting the image and thumbnail path to be the same.  This works fine for static images.  (I also have a question about setting custom thumbnail names, but that's for a different post, if I get this working). 

If there's no check for file name or mime type, how come it only works with jpeg images?

Re: Dynamic Images

So, out of a hunch, I copied my dynamic xml file (currently named main.php?g2_view=simpleviewer.Simpleviewer&g2_itemId=25) to a static file named the default file gallery.xml, and it worked!  So the problem seems to be in the dynamic xml file. 

To test it, I copied gallery.xml to gallery.php, added a header("Content-Type: text/xml"); to the top, and it didn't work.  Any idea why the "dynamic" file (in this case, essentially a static file called gallery.php) doesn't work, when it's outputting the same content as the static file?

Thanks

Re: Dynamic Images

I use dynamic XML and dynamic images just fine. Your problem might be in the query string. You might need to use "&" instead of "&". Try to change "main.php?g2_view=simpleviewer.Simpleviewer&g2_itemId=25" to "main.php?g2_view=simpleviewer.Simpleviewer&g2_itemId=25".

Re: Dynamic Images

I know dynamic XML files work, I've been able to make simpleviewer work with a drupal installation, but for some reason it doesn't want to work with Gallery.  I've moved everything from from my development server at home ( a Mac box running Apache 1.3.33 and PHP 5.2.2) to my testing server (a linux box running Apache 1.3.33 and PHP 5.2.1) to test to see if it was just my server.  Same results.  But now I can post the links smile.

Re: Dynamic Images

Looks like I can't post links until I've been here 5 days sad.  So I guess I'll have to wait until then to post the urls.

Re: Dynamic Images

OK, scratch the idea of replacing & with &. Apparently it doesn't work. The problem is still in the fact that xml file script cannot get more than one parameter.

What I did is instead of usuing this code:

XML loader page:

fo.addVariable("xmlDataPath", "gallery.php?s=<?=$s?>&p=<?=$p?>&setid=<?=$setid?>");

dynamic XML page:

$s = $_REQUEST['s'];
$p = $_REQUEST['p'];
$setid = $_REQUEST['setid'];

I am using the following hack:

XML loader page:

fo.addVariable("xmlDataPath", "gallery.php?h=<?=$s?>-<?=$p?>-<?=$setid?>");

dynamic XML page:

$hack = $_REQUEST['h'];
list($s, $p, $setid) = split("-", $hack);

Basically, I am sending only 1 parameter, while in fact there are 3.

Hope it helps.

Re: Dynamic Images

By golly, you're right!  That's the problem.  Unfortunately, I can't get around using two parameters for Gallery.  The current link looks like this:

main.php?g2_view=simpleviewer.Simpleviewer&g2_itemId=25

Gallery determines which module/view to display with the first parameter, and the second parameters is the id of the album to display. so aside from hacking main.php, which I really don't want to do in order to keep the module as self contained as possible, there's nothing I can do. 

So it's a bug either on the flash side, or in the swfobject.js file.  I've found the original source for swfobject.js, and I'm deconstructing that.

Thanks for the help, now at least I know where the problem lies.

Re: Dynamic Images

You don't really need to hack main.php. Just make something like simpleviewer.php with the following code inside:

<?

$id = $_REQUEST['id'];

header ("Location: main.php?g2_view=simpleviewer.Simpleviewer&g2_itemId=$id");

?>

And use simpleviewer.php?id=25 inside the loader.

That should work.

Re: Dynamic Images

Brilliant smile.  That works.  Thanks a bunch.  Not quite the final solution I wanted, but at least it works

Re: Dynamic Images

You're welcome.

It's obviously a hack, but as long as it works I am too lazy to try to do it the right way.