]> git.decadent.org.uk Git - memories.git/blob - templates/photo/sized
c0a0f10796eee5e45e5ecbdb39b4e1b47a72ac8a
[memories.git] / templates / photo / sized
1 <div class="photoview" id="photoview">
2     [% SET sizes = request.config.sizes %]
3     [% IF request.params.exists("scale") %]
4         [% SET size =  request.params.scale  %]
5     [% ELSIF request.session.scale %]
6         [% SET size =  request.session.scale  %]
7     [% ELSE; SET size =  1; END; %]
8     <img src="[% photo.sized_url(size) %]" id="thephoto">
9     <p> (Original size [%photo.dimensions %]) </p>
10     <p>
11     <script> function change_size(size) { 
12         new Ajax.Updater("photoview", "[%base%]/photo/sized/[%photo.id%]?scale="+size);
13     } </script>
14     Size: 
15     [% SET i = 0; WHILE i < sizes.size %]
16         [% IF photo.is_bigger(sizes.$i);  %]
17             [% IF i == size %]
18                 [% sizes.$i %]
19             [% ELSIF sizes.$i == "full" %]
20                 <a href="[%photo.path("url")%]">full</a>
21             [% ELSE %]
22                 <a href="javascript:change_size([%i%])">[% sizes.$i %]</a>
23             [% END %]
24         [% END; %] 
25     [% SET i = i + 1 %]
26     [% END %]
27     </p>
28     [%# Now put it back in the session %]
29     [% SET request.session.scale = size %]
30 </div>