-
Dear John: I wrote you yesterday but fell asleep on the sofa before I posted it, I guess. Wanted to tell you that I finally was able to get back to the gallery site and did exactly what you said and it worked perfectly! I LOVE it!!! I love how you matched the background color too. So I'm working on applying it to my other gallery site. I'll show you when I'm done. Thanks a million!!!
Aloha, kuau :)
-
For my other gallery site, I use a custom template & variables to create the page with the slideshow and the thumbnails. I was planning to add a field to the database to hold the number of rows in the thumbs array because it varies from one artist to the next. It suddenly occurred to me that perhaps the getpics.php script may already calculate how many files are in the folder in order to do the paging and, if so, could I use that total to calculate the number of rows on the fly, ie. 5 x $rows? Is it possible to pass a variable value from javascript to php? Just wondering. Thanks, kuau :)
-
I suppose that it might be possible. But there is the issue of PHP (the server actually) generally needing to know what the values are when the page is served. I think getpics could be modified to make a server variable that could then be used here like:
PHP Code:
var dimension="5x<?php=$_rows?>"
Not sure If I have my PHP syntax right. The bigger issue is whether the $_rows would be ready in time or not. Since this is already a javascript though, I'd try passing the value directly (worked here in local testing):
Code:
var dimension="5x"+Math.ceil(galleryarray.length/5);
Also (unrelated to this particular question), if you are going to use this for various galleries where the path might be different than:
and on pages that might have other scripts than we've already covered, this (be sure to use the added semicolon on the targetlinkdr line):
Code:
. . . iptionprefix=[0, ""]
var gsortorder=""
var targetlinkdir="http://www.billmyrickartist.com/img/lg/"; //large gallery
(function(){
for (var i = galleryarray.length-1, j ; i > -1 ; --i)
for (j = slides.length-1 ; j > -1 ; --j)
if(slides[j][0].replace(/^.*\//,'') == galleryarray[i][0])
galleryarray[i][1]=slides[j][1];
})();
</script>
would be better than:
Code:
. . . iptionprefix=[0, ""]
var gsortorder=""
var targetlinkdir="http://www.billmyrickartist.com/img/lg/" //large gallery
for (var i = galleryarray.length-1, j ; i > -1 ; --i)
for (j = slides.length-1 ; j > -1 ; --j)
if(slides[j][0].replace(/\/img\/lg\//,'') == galleryarray[i][0])
galleryarray[i][1]=slides[j][1];
</script>
-
PHP Code:
...
var dimension="5x<?php=$_rows?>"
...
I'd use:
PHP Code:
var dimension="5x<?php echo $_rows; ?>"
Just in case people don't have the short_tags enabled on their server.
-
Superb Solution
Dear John: I didn't get an email alert so didn't find your response until today... Happy Thanksgiving by the way!
I love to do things in the most efficient way possible and you have certainly accomplished that for me in only 34 characters!! I would have had to manually count all the files for 53 artists, divide by 5 and store the values in a database table to be retrieved using php, and update the values every time I added files. This is a fabulous solution that solves my 3" gap problem in an elegant way. Thank you so much!!! Here is one of the pages so you can see how much you have contributed to my design...
http://www.sargentsfineart.com/artist/auction.php
Mahalo plenty!!! kuau :)
-
On second thought, forget that page -- it won't work properly until I get all the images uploaded. This is one of the pages that works perfectly already...
http://www.sargentsfineart.com/artist/wishard.php