From our sponsor: Meco is a distraction-free space for reading and discovering newsletters, separate from the inbox.
In this tutorial we are going to create a nice and fresh image gallery. The idea is to show the albums as a slider, and when an album is chosen, we show the images of that album as a beautiful photo stack. In the photo stack view, we can browse through the images by putting the top most image behind all the stack with a slick animation.
We will use jQuery and CSS3 properties for the rotated image effect. We will also use the webkit-box-reflect property in order to mirror the boxes in the album view – check out the demo in Google Chrome or Apple Safari to see this wonderful effect.
We will also use a bit of PHP for getting the images from each album.
So, let’s start!
Tiny break: 📬 Want to stay up to date with frontend and trends in web design? Subscribe and get our Collective newsletter twice a tweek.
The Markup
In our HTML structure we will have several elements. The main ones are for the album columns with thumbnail and description, and the preview with the photo stack.
The structure for the album view is going to look as follows:
<div id="ps_slider" class="ps_slider"> <a class="prev disabled"></a> <a class="next disabled"></a> <div id="ps_albums"> <div class="ps_album" style="opacity:0;"> <img src="albums/album1/thumb/thumb.jpg" alt=""/> <div class="ps_desc"> <h2>Album title</h2> <span>Description text</span> </div> </div> <div class="ps_album" style="opacity:0;"> ... </div> ... </div> </div>
The opacity of the album div is going to be 0 in the beginning, we will then use JavaScript to fade in the columns.
The information that we need to provide in the HTML is the location of each album and its thumbnail images. With our little PHP script we will then get all the images from the respective album.
The structure for the dark overlay and the preview with the photo stack is going to look like this:
<div id="ps_overlay" class="ps_overlay" style="display:none;"></div> <a id="ps_close" class="ps_close" style="display:none;"></a> <div id="ps_container" class="ps_container" style="display:none;"> <a id="ps_next_photo" class="ps_next_photo" style="display:none;"></a> </div>
We will dynamically insert the pictures of each album into the ps_container div.
Now, let’s take a look at the PHP.
The PHP
Our PHP file will be called from our JavaScript and we will get the information with AJAX call. The PHP looks as follows:
$location = 'albums'; $album_name = $_GET['album_name']; $files = glob($location . '/' . $album_name . '/*.{jpg,gif,png}', GLOB_BRACE); $encoded = json_encode($files); echo $encoded; unset($encoded);
The CSS
The style for the gallery is going to contain some CSS3 properties and also a Webkit specific property for a mirror effect.
Let’s start by resetting some paddings and margins and defining the general style for the body:
body, ul, li, h1, h2, h3{ margin:0; padding:0; } body{ background:#121212; font-family:Arial, Helvetica, sans-serif; font-size:11px; color:#fff; overflow-x:hidden; }
We will continue with the style of the preview. The overlay is going to have the following style:
.ps_overlay{ z-index:90; background:#111; width:100%; height:100%; position:fixed; top:0px; left:0px; opacity:0.5; }
The container for the photo stack will have a defined height and width. We will position it absolutely and center it with the “50%/negative margins” method:
.ps_container{ width:480px; height:350px; position:absolute; top:50%; margin-top:-175px; left:50%; margin-left:-240px; z-index:100; }
The image will have a thick white border and a nice box shadow. We will center the image relatively to its container but since we will only know the width and height of the images once we dynamically add them, we will set the margins in our JavaScript function:
.ps_container img{ border:10px solid #fff; position:absolute; top:50%; left:50%; -moz-box-shadow:1px 1px 10px #000; -webkit-box-shadow:1px 1px 10px #000; box-shadow:1px 1px 10px #000; }
The close button for the preview is going to be fixed at the top right of the window:
a.ps_close{ background:#000 url(../images/close.png) no-repeat center center; cursor:pointer; width:56px; height:56px; position:fixed; right:10px; top:10px; z-index:1000; -moz-border-radius:10px; -webkit-border-radius:10px; border-radius:10px; opacity:0.6; }
We will show a “next photo” element on top of the current image when the user hovers over it:
a.ps_next_photo{ position:absolute; top:50%; left:50%; width:56px; height:56px; margin:-28px 0 0 -28px; z-index:200; cursor:pointer; background:#000 url(../images/next_photo.png) no-repeat 50% 50%; opacity:0.6; -moz-border-radius:10px; -webkit-border-radius:10px; border-radius:10px; }
The hover classes for the last two elements:
a.ps_next_photo:hover, a.ps_close:hover{ opacity:0.8; }
Now we are going to define the style for the album view and its columns. The slider container will be positioned relatively. With the auto values for the left and right margins we center the container horizontally on the page:
.ps_slider{ width:845px; height:300px; position:relative; margin:110px auto 0px auto; }
The navigation elements are going to have the following style:
.ps_slider a.next, .ps_slider a.prev{ position:absolute; background-color:#000; background-position:center center; background-repeat:no-repeat; border:1px solid #232323; width:20px; height:20px; top:50%; margin-top:-10px; opacity:0.6; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; cursor:pointer; outline:none; } .ps_slider a.prev{ left:-30px; background-image:url(../images/prev.png); } .ps_slider a.next{ right:-30px; background-image:url(../images/next.png); } .ps_slider a.prev:hover, .ps_slider a.next:hover{ border:1px solid #333; opacity:0.9; }
We also define a class for the navigation elements when they are disabled:
.ps_slider a.disabled, .ps_slider a.disabled:hover{ opacity:0.4; border:1px solid #111; cursor:default; }
Each album column is going to have the following style:
.ps_slider .ps_album{ width:140px; height:310px; padding:10px; background-color:#333; border:1px solid #444; position:absolute; top:0px; text-align:center; cursor:pointer; -moz-box-shadow:1px 1px 4px #000; -webkit-box-shadow:1px 1px 4px #000; box-shadow:1px 1px 4px #000; -webkit-box-reflect: below 5px -webkit-gradient( linear, left top, left bottom, from(transparent), color-stop(0.6, transparent), to(rgb(18, 18, 18)) ); }
The last property is the Webkit box reflex that mirrors the columns. We say that it should mirror the element in a gradient like way.
We add a hover class for the whole column:
.ps_slider .ps_album:hover{ background-color:#383838; }
The thumbnail image and the content of the column are going to have the following styles:
.ps_slider .ps_album img{ height:90px; border:1px solid #444; -moz-box-shadow:1px 1px 4px #000; -webkit-box-shadow:1px 1px 4px #000; box-shadow:1px 1px 4px #000; } .ps_slider .ps_album .ps_desc{ display:block; color:#666; background:#111 url(../images/overlay.png) no-repeat bottom right; height:200px; margin-top:10px; text-align:left; line-height:20px; overflow:hidden; text-overflow:ellipsis; border:1px solid #393939; -moz-box-shadow:0px 0px 2px #000 inset; -webkit-box-shadow:0px 0px 2px #000 inset; box-shadow:0px 0px 2px #000 inset; } .ps_slider .ps_album:hover .ps_desc{ background-image:none; } .ps_slider .ps_album .ps_desc span{ display:block; margin:0px 10px 10px 10px; border-top:1px solid #333; padding-top:5px; } .ps_slider .ps_album .ps_desc h2{ margin:10px 10px 0px 10px; text-align:left; padding-bottom:5px; font-weight:normal; color:#ddd; text-shadow:0px 0px 1px #fff; border-bottom:1px solid #000; }
The loading element will show when we click on an album and all the images get loaded in the preview:
.ps_slider .loading{ background:#121212 url(../images/loading.gif) no-repeat 50% 50%; position:absolute; top:0px; left:0px; width:100%; height:100%; opacity:0.7; }
For the opacity to work in IE you need to add this filter (with the right value):
filter:progid:DXImageTransform.Microsoft.Alpha(opacity=60);
I did not want to uglify the code.
Let’s add the magic!
The JavaScript
First, we need to define some variables that help us control the album navigation and keep some elements. The variable positions saves the left value for each album column. This depends on the width of the column.
/** * navR,navL are flags for controlling the albums navigation * first gives us the position of the album on the left * positions are the left positions for each of the 5 albums displayed at a time */ var navR,navL = false; var first = 1; var positions = { '0' : 0, '1' : 170, '2' : 340, '3' : 510, '4' : 680 } var $ps_albums = $('#ps_albums'); /** * number of albums available */ var elems = $ps_albums.children().length; var $ps_slider = $('#ps_slider');
We are going to give an initial positioning to the album columns:
/** * position all the albums on the right side of the window */ var hiddenRight = $(window).width() - $ps_albums.offset().left; $ps_albums.children('div').css('left',hiddenRight + 'px'); /** * move the first 5 albums to the viewport */ $ps_albums.children('div:lt(5)').each( function(i){ var $elem = $(this); $elem.animate({'left': positions[i] + 'px','opacity':1},800,function(){ if(elems > 5) enableNavRight(); }); } );
For sliding through the albums, we will define what happens when we click on the next or previous button and create two functions for moving left or right:
/** * next album */ $ps_slider.find('.next').bind('click',function(){ if(!$ps_albums.children('div:nth-child('+parseInt(first+5)+')').length || !navR) return; disableNavRight(); disableNavLeft(); moveRight(); }); /** * we move the first album (the one on the left) to the left side of the window * the next 4 albums slide one position, and finally the next one in the list * slides in, to fill the space of the first one */ function moveRight () { var hiddenLeft = $ps_albums.offset().left + 163; var cnt = 0; $ps_albums.children('div:nth-child('+first+')').animate({'left': - hiddenLeft + 'px','opacity':0},500,function(){ var $this = $(this); $ps_albums.children('div').slice(first,parseInt(first+4)).each( function(i){ var $elem = $(this); $elem.animate({'left': positions[i] + 'px'},800,function(){ ++cnt; if(cnt == 4){ $ps_albums.children('div:nth-child('+parseInt(first+5)+')').animate({'left': positions[cnt] + 'px','opacity':1},500,function(){ //$this.hide(); ++first; if(parseInt(first + 4) < elems) enableNavRight(); enableNavLeft(); }); } }); } ); }); } /** * previous album */ $ps_slider.find('.prev').bind('click',function(){ if(first==1 || !navL) return; disableNavRight(); disableNavLeft(); moveLeft(); }); /** * we move the last album (the one on the right) to the right side of the window * the previous 4 albums slide one position, and finally the previous one in the list * slides in, to fill the space of the last one */ function moveLeft () { var hiddenRight = $(window).width() - $ps_albums.offset().left; var cnt = 0; var last= first+4; $ps_albums.children('div:nth-child('+last+')').animate({'left': hiddenRight + 'px','opacity':0},500,function(){ var $this = $(this); $ps_albums.children('div').slice(parseInt(last-5),parseInt(last-1)).each( function(i){ var $elem = $(this); $elem.animate({'left': positions[i+1] + 'px'},800,function(){ ++cnt; if(cnt == 4){ $ps_albums.children('div:nth-child('+parseInt(last-5)+')').animate({'left': positions[0] + 'px','opacity':1},500,function(){ //$this.hide(); --first; enableNavRight(); if(first > 1) enableNavLeft(); }); } }); } ); }); }
The next helper functions deal with disabling and enabling the the navigation items:
/** * disable or enable albums navigation */ function disableNavRight () { navR = false; $ps_slider.find('.next').addClass('disabled'); } function disableNavLeft () { navL = false; $ps_slider.find('.prev').addClass('disabled'); } function enableNavRight () { navR = true; $ps_slider.find('.next').removeClass('disabled'); } function enableNavLeft () { navL = true; $ps_slider.find('.prev').removeClass('disabled'); }
In the next steps we will define what happens when we open an album. We first make the loading element appear and show the preview after we loaded all the images. The information of the source comes from an AJAX call to our PHP class. For the rotation effect, we use the rotate CSS3 property which we restrict to a certain range of degrees, so that we don’t rotate an image crazily:
var $ps_container = $('#ps_container'); var $ps_overlay = $('#ps_overlay'); var $ps_close = $('#ps_close'); /** * when we click on an album, * we load with AJAX the list of pictures for that album. * we randomly rotate them except the last one, which is * the one the User sees first. We also resize and center each image. */ $ps_albums.children('div').bind('click',function(){ var $elem = $(this); var album_name = 'album' + parseInt($elem.index() + 1); var $loading = $('<div />',{className:'loading'}); $elem.append($loading); $ps_container.find('img').remove(); $.get('photostack.php', {album_name:album_name} , function(data) { var items_count = data.length; for(var i = 0; i < items_count; ++i){ var item_source = data[i]; var cnt = 0; $('<img />').load(function(){ var $image = $(this); ++cnt; resizeCenterImage($image); $ps_container.append($image); var r = Math.floor(Math.random()*41)-20; if(cnt < items_count){ $image.css({ '-moz-transform' :'rotate('+r+'deg)', '-webkit-transform' :'rotate('+r+'deg)', 'transform' :'rotate('+r+'deg)' }); } if(cnt == items_count){ $loading.remove(); $ps_container.show(); $ps_close.show(); $ps_overlay.show(); } }).attr('src',item_source); } },'json'); }); /** * when hovering each one of the images, * we show the button to navigate through them */ $ps_container.live('mouseenter',function(){ $('#ps_next_photo').show(); }).live('mouseleave',function(){ $('#ps_next_photo').hide(); });
The nice animation of putting the current image at the back of our stack is defined in the following:
/** * navigate through the images: * the last one (the visible one) becomes the first one. * we also rotate 0 degrees the new visible picture */ $('#ps_next_photo').bind('click',function(){ var $current = $ps_container.find('img:last'); var r = Math.floor(Math.random()*41)-20; var currentPositions = { marginLeft : $current.css('margin-left'), marginTop : $current.css('margin-top') } var $new_current = $current.prev(); $current.animate({ 'marginLeft':'250px', 'marginTop':'-385px' },250,function(){ $(this).insertBefore($ps_container.find('img:first')) .css({ '-moz-transform' :'rotate('+r+'deg)', '-webkit-transform' :'rotate('+r+'deg)', 'transform' :'rotate('+r+'deg)' }) .animate({ 'marginLeft':currentPositions.marginLeft, 'marginTop' :currentPositions.marginTop },250,function(){ $new_current.css({ '-moz-transform' :'rotate(0deg)', '-webkit-transform' :'rotate(0deg)', 'transform' :'rotate(0deg)' }); }); }); });
We animate the top and left margins with certain values that create the “putting back” effect. Since our structure always shows the last image on the top, we will also need to insert the moving image at the beginning, so that it appear as last one in the stack.
Clicking on the close element brings us back to the album view:
/** * close the images view, and go back to albums */ $('#ps_close').bind('click',function(){ $ps_container.hide(); $ps_close.hide(); $ps_overlay.fadeOut(400); });
Our famous resize function resizes the image according to the given container width and height.
In the end of the function we apply the sizes and we also apply the negative margins – remember, that’s the way we can center an absolute positioned element; we defined top and left in the CSS to be 50%, so now we need to pull it to the right place with these margin values.
/** * resize and center the images */ function resizeCenterImage($image){ var theImage = new Image(); theImage.src = $image.attr("src"); var imgwidth = theImage.width; var imgheight = theImage.height; var containerwidth = 460; var containerheight = 330; if(imgwidth > containerwidth){ var newwidth = containerwidth; var ratio = imgwidth / containerwidth; var newheight = imgheight / ratio; if(newheight > containerheight){ var newnewheight = containerheight; var newratio = newheight/containerheight; var newnewwidth =newwidth/newratio; theImage.width = newnewwidth; theImage.height= newnewheight; } else{ theImage.width = newwidth; theImage.height= newheight; } } else if(imgheight > containerheight){ var newheight = containerheight; var ratio = imgheight / containerheight; var newwidth = imgwidth / ratio; if(newwidth > containerwidth){ var newnewwidth = containerwidth; var newratio = newwidth/containerwidth; var newnewheight =newheight/newratio; theImage.height = newnewheight; theImage.width= newnewwidth; } else{ theImage.width = newwidth; theImage.height= newheight; } } $image.css({ 'width' :theImage.width, 'height' :theImage.height, 'margin-top' :-(theImage.height/2)-10+'px', 'margin-left' :-(theImage.width/2)-10+'px' }); } });
And that’s it! We hope you enjoyed this tutorial and find it useful!
P.S. Because of some Webkit properties, this demo is a really nice experience if you use a Webkit browser like Chrome or Safari. It will also be fully functional in all latest browsers like Firefox and IE (without those beautiful properties, though).
Mary
I’d love to add three menus that when clicked will show a modal overlay with information in it. I have been able to add the links but when clicking i am not able to display the modal overlay. Can you pls help?
Thank you!
R
please help me, I tried adding new photos but it won’t show up. The directory is correct, I don’t get it why won’t it show up!
Hi,
Thank you very much for this gallery !
But i have a problem, the images appear randomly and i would like appear in alphabetic or numeric order. It is possible ?
Thanks !
PS : sorry for my bad english …
I too am having a problem. If I customise one of the containers with my own images (even if the are smaller than the original images) they do not show when I click through, however the original images in the script do?
Where are the images stored? Why does it populate with the old images but do nothing with new images added?
Check http://www.dclandscapes.com/photostack.html to see. Any help would be appreciated
Very good tutorial. The functionality of this is very awesome.
Great tutorial giving for us.
thanks
Your tutorials are a treasure! I am not sure if the DWTFYWWI license is legally bounding (not sure even if it’s a legal document), however the intention it’s clear to waive the copyright and make it public available for any use, so it should be somewhat equal to Public Domain License. However, for the intentions of “doing whatever anybody wants to do with the code” (kindly paraphrased) it seems more appropriate the MIT license, because it is explicit about the sub-licenses and sale of the software/code (but while retaining a copyright notice attributing the work to the author). It is understandable that under Public Domain you rather prefer to release it without requiring any copyright notice; still considering that your code may be used commercially and there could be others that will build on it, they are better protected by MIT kind of license than Public Domain license(s) (with the price of attributing the copyright to you). 🙂 This is legal mambo jumbo… what I wanted to point out it’s in fact related to your declared “anti-copyright” position. In my humble opinion the best possible anti-copyright position it’s to… copyright it. Prove of this way are well known projects like Linux or Apache… If attribution it’s a problem for you, my best guess will be Apache License. Leaving aside the legal issue, I would like to thank you for your tutorials and demos, I will certainly use your examples and build upon them in my commercial adventure as web designer and with your permission I would like to give credit where credit is due. Thanks again.
Beautifully done!
– Is it possible to re-size images so they take a bit more of the screen (and also have different size images)?
– Is it possible to have the “next” button somewhere else as opposed to in the middle of the photo?
– Is it possible to have a “previous” button?
Thank you,
Motti
thank you but i cant work with this script.
Hi Daniel, could you copy your php code to see how you solved?
I said Daniel, but if anyone has the php code and it works, I also served.
superb!!!…awesum!!!
Hello,
A very nice toturial you have and thanks for sharing it to us.
By the way, im having trouble with the image to view in screen.. i already upload it to my webpage can you give me some idea on how to view my image in mypage? i tried to open the php file in my webpage but it returns “false” instead of “[]”
There seems to be an IE bug..
Its really frustrating, because its working amazing in all other browsers, i’m fine with IE not doing the rotation, but in IE the
“stack view” works only the very first time you click on a album, clicking an other album afterwards, the mask opacity is ignored and clicking the same album a second time it does nothing..just a spinning loader..
I know its the ajax $.get method because if you clear the browser cache it works again(only one time).
Hope some body knows the fix!!
thnx
i couldn’t make work i didnt see anywhere javascript is added
i dond know what is problem i am just trying demo yet, i am clicking picture it is keep loading pictures doesnt come up
can you e-mail me what is problem
thanks
Hello, I love your gallery and would love to use it on my portfolio website. However, I would like to have your gallery inside of another jQuery slider that is a tab that pulls down from the top right corner of my site. (You can’t see the tab right now, because the photostack is covering it up.) The content within the tab is hidden in a panel that does not get displayed until the user clicks on the tab. I placed the photostack inside of the panel for the tab, but it won’t stay hidden. Any ideas on how to make this work? I would love any advice/ideas asap, as I this is the last item I need to do to finish my website. Thanks!
Hello,
I would use this nice gallery but the images do not load ..
I forgot quelqe thing?
Thank you in advance
http://www.100-pour-100-site.com/index.html
Many thanks for this tutorial, very clear, well explained, clean… and amazing effect.
One question, I want to use it twice on a web, I mean, for shows and for projects , they are in the same page as this web just have one page, but different div’s. It just work in one, how could I make it work in both div’s?
Many thanks
Hi Mary Loo,
Love this, but I’m having the same problem where the images don’t load. Can you help me correct this? I’d really like to use this for my gallery.
http://www.gingerkidcreative.com/portfolio.html
Thanks in advance!
Hi Jaime,
(and to others that might have the same problem)
you have an error showing up when an album is clicked:
GET http://www.gingerkidcreative.com/photostack.php?album_name=album2 404 (Not Found)
If you make your folder structure (and names) of the albums like it’s done in the tutorial, it should work fine.
Hope it helps,
ML
wow this is great I’ll try it right away
Hi again Mary Lou,
Thanks for your advice, and I’ve done this, however the stacks album is still not loading. Actually even when I open your downloaded version it won’t work either… just shows the loading graphic. I’ve read through the comments and it seems I’m not the only one with this problem. What else would you suggest?
Thanks a million!
Never mind! I totally figured it out! It’s AWESOME! Thanks for sharing!
help me !
convert photostack.php from photostack.aspx . thank you
Hi Mary!
You’ve got a nice script, but I would like to have the albums in reverse order.
So the latest album should be first and the oldest last
How should I do this?
Thanks!
hello,
pls help me i have use photostack gallery but after downloading image hover effect is not working pls say me what is the problem
Hi,
Great Tut…I am wondering if there is a way to avoid the load animation where everything slides in from the right when the gallery first loads. It is nice, but I would prefer if it could just appear on load rather than animate in …fade in or just be there?
Any help?
Thanks….R
Hi, Mary!
It is avesome and runs when I call it on your site. But… When uploaded to my server, I also experienced the problem on gallery opening. Could you help me?
Thanks a lot!
L
Thank you for this great script, Although it has some minor fault but hey for free scripts this is already considered excellent.
Anyway, I’ve build a Drupal module based from your script and done some modification to perfected the script.
For those who are interested, you can view the demo at : http://www.victheme.com/product/photo-stack-drupal-7-modules and click the demo button
Hello again, Mary. Another awasome worked you’ve done.
May I use some of your jquery code in this web for my commercial wok?
If you dont mind, can I download the credit from you as the header text of that code.
Thanks, Mary.
Great tut, thanks.
Hey, this work with asp.net? Can someone let me know please?
I like the script. The only thing that annoys me is that it is again not just a plug and play.
Of course I understand that some time has to be invested. But I think this is the biggest mistake for this script yet. Stopping many developers from implementing this script. Because as you know. Time is money. And if you want to see your script widely implemented. I suggest getting it more basic.
Good job… very nice!!!!
Hello,
I wondered if there is a simple way to show only the images of an preselected album, without the album part?
@Alex: it is plug and play for true developers, because they already have a local php server running.
@Alejandro: It should work if you create an ASP version of the PHP file which reads the images.
Just awsome!
I got one question, if I would like to use just the photostack functionality, what should I need to erease, or what do I need to add?
First, It is an amazing plugin, but I had problems, I changed a little bit because I need to show just 4 images of 330 of width, when I changed width of the slider the prev button is not working. How do I need to consider when I increase the size of the gallery to 1135px?
Mary,
Excellent job! Code was well documented and I was easily able to edit what I needed.
I added a random rotation to each album so when they animate in they are at dif angles. Would love to share the code with you, just email me.
Thank you for this great plugin. It’ s really nice.
I’ve been playing around with it a lot, but since i am not a js guru, i can’t achieve what i need.
I am trying to increase the width of each galleries and therefore display only 3 at a time instead of 4.
When i manage to increase the size and modify the “var positions” by increasing the value and removing one position, the script is still working when you click “next” but not when you click “previous”. The last one does not disappear anymore.
does anybody have an idea of the values to be changed?
thanks in advance
Great tutorial giving for us.
My client desperately wants the random feature in the javascript disabled so that the photos just view in order that I have them saved in my albums folder. Could someone please please give me the proper code that will change this?
Thanks!
The page is:
http://vintagewoodworksflorida.com/gallery.html
Es simplemente impresionante…
Here’s a quick fix to make the images load and stack in the order they are saved on the server.
http://jsfiddle.net/cQGrn/1/
Just replace the “$ps_albums.children(‘div’)…” code-block with the one provided.
Thank you very much for this one and indeed for the rest of your tutorials shared with us!
Such an amazing organization, I love it.
Having an issue incorporating this into CMS. Everything works but the gallery is having an issue with photostack.php. I’ve tried every kind of path I can think of. The javascript file calls for the absolute path to the php file so I know it’s finding the phpfile. I literally copied your example over, so there shouldn’t be any paths to change?!? Any ideas on how I can get around using the photostack.php? Thank you for any help!!
I found out that the index.html must reside IN the gallery directory for it all to work. But what happens if you work off of templates. I’m using Expression Engine and so I have to link everything. That’s when it all breaks because of that photostack.php.
Using absolute links in these places below also doesn’ t work…
<?php
$location = 'http://mysite.com/albums';
$album_name = $_GET['album_name'];
$files = glob($location . 'http://mysite.com/' . $album_name . '/*.{jpg,gif,png}', GLOB_BRACE);
$encoded = json_encode($files);
echo $encoded;
unset($encoded);
Dear Mary Lou,
Your work is brilliant. Congratulations for this post.
Nevertheless, I have some issue with Internet Explorer 8. All the images appear on the left. Please, see http://tinyurl.com/3j5yym6
For this capture, I used http://ipinfo.info/netrenderer/index.php
Thanks
OK – I love this concept. The problem with it should be easy to fix. When you click on a category and a stack of images appears, it is not intuitively obvious (to the casual) how you exit that category. It takes too much time to figure out that you have to go to the upper righthand corner and click the ‘X’.
I would put this close mechanism much closer to the stack of images – maybe at the upper left or right corner of the stack – or maybe an exit button just below the stack.