Has anyone created any "fluid" themes. By fluid I mean where the image and an indexes are automatically sized to the screen?
Take for example Smug Mug :
http://cmac.smugmug.com/gallery/5363890_2awbk/#747663493_Nf4hE Resize your browser and watch what happens.
-m
Comments
Ignoring page events (resize/reload) what about just the base case : When you enter a page the elements are sized based on your browser window? So it picks a thumbnail and image size for you based on your screen resolution. Do you know of any themes that do this already?
You can do this with JS/jQuery but the problem is that you have to pass the browserwindow values to PHP so that Zenphoto can generate the images sized accordingly. And here it gets a little complicated as you can't direclty. PHP is already execute when you call the JS, so you have to pass the values via a form to a intermediate page that in return passes them back to php for the actual display....
Or you could pre generate all possible sizes and change them via jQuery directly.
I could see having a few presets for common monitor sizes, but a truly dynamic setup would be cool too.
http://www.smashingmagazine.com/2009/06/09/smart-fixes-for-fluid-layouts/ Is what I'ld like to do.
My goal in doing this is to have a theme that looks good on a big monitor and a phone w/out having to click on anything.
Also thinking about making it Ajax so that you can change pictures w/out doing a full page load. I would use this sort of technique : http://stackoverflow.com/questions/1867205/ajax-how-to-change-url-by-content
Note that loading for example image.php via ajax within album.php will not work because of the differences of JS and PHP. JS is executed in the browser environment "on the fly", while PHP is executed on page load only. So everything you want to load without page reload has to be pregenerated in js arrays or such. Or you have to setup a lot of things manually on the loaded page as our PHP contexts will not work as with normal themes.
Let us know when you have something to show.
I am not sure if too much fancy js stuff will work on mobile devices in general. I still think less is more with this.
Switching picture dynamically without triggering a page change is actually quite simple and doesn't involve ajax at all (this is rather what we used to call dhtml 10 years or so ago).
You just have to listen for thumbnail click. Your listener will then set the src attribute of your main image container adequately.
For example, suppose your dom structure is as follows:
`
`
Then you just need to add a click listener on #thumbs and assert that the node name of the target of the event is 'img'. Note that i've introduced here a sref attribute: granted it may not pass validators, but it is way easier that way. So using jquery we should have something like this (blind-code):
`
var imgContainer = $('img-container');
$('#thumbs').click(function(e) {
var t = e.target;
if ( t.nodeName == 'img' ) {
var imageUrl = t.attr('sref');
imgContainer.attr('src', imageUrl);
}
});
`
There you should be done. Of course you may also want to add some transition.
However with that you're only half-way. Indeed you may also want your image page to look like your album page (in case the visitor has disabled js).
For this you may want to simply include album.php in image.php (nothing more, nothing less), and in album, set the context accordingly (for instance lookup the correct album page, highlight the correct image, etc.).
That's the way i implemented it anyway. All the work is done in classes/GalleryController (request singleton) if you want to have a look at it.
regards
I did not mean it is really problematic it's just some work to do.
You could also just put pregenerate html stuff into js arrays and swap the content from there without directly loading an external file. Seems to work quite well for me when I did the last time (that site is not online). I guess there are different ways to the same solution. And I admit being far from being a real JS wizard.
Another, more agnostic, approach is to blindly rely on what is already present. If you link to a given album page, you could just load this album page passing in a flag (for instance) telling the user requested a page fragment, and not the whole album page. All other relevant information is already embedded in the url. Nothing, then, has to be pre-generated.
But again, as you said, there may be as many solutions to a given problem as there are people trying to solve it.
Regards
Yes, that is a drawback. It is mainly for sites where you really know that or if you just want to do the image.php prev/next stuff.
And we are just discussion a little.