comparison perl/make_gallery_js.pl @ 11:ed6ee381b8fd judyates

[svn r12] compressed photos and assembled them into a working web gallery
author rlm
date Mon, 12 Apr 2010 02:31:43 -0400
parents
children 2f433df9b961
comparison
equal deleted inserted replaced
10:ed52b2b7cbc1 11:ed6ee381b8fd
1 #!/usr/bin/perl
2
3
4 use File::Find;
5 use Set::Object;
6 use List::Util 'shuffle';
7
8 use Image::Size;
9
10 $header = <<HERE;
11 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
12 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
13 <head>
14 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
15
16 <title>Judy Yates - Prints</title>
17
18
19 <!--(E)2 Gallery Pro <head> Files-->
20 <!--(E)2 Gallery Config FIle-->
21 <!--End (E)2 Gallery Config FIle-->
22 <!--(E)2 Gallery Style Sheet Link-->
23
24 <link href="firetest.css" rel="stylesheet" type="text/css" />
25
26 <link href="e2gallerypro/design/e2gallerypro/design.css" rel="stylesheet" type="text/css" />
27
28 <script type="text/javascript">
29 //modify this path if needed ^ Correlates with Style Sheet Path above
30 var designPath="e2gallerypro/design/e2gallerypro/";
31 </script>
32 <!--End (E)2 Gallery Style Sheet Link-->
33
34 <!--Mootools-->
35 <script type="text/javascript" src="e2gallerypro/js/mootools-1.2-core.js"></script>
36 <script type="text/javascript" src="e2gallerypro/js/mootools-1.2-more.js"></script>
37 <!--End Mootools-->
38 <!--(E)2 Gallery Javascript-->
39
40 <script type="text/javascript" src="e2gallerypro/js/setupvars.js"></script>
41 <script type="text/javascript">
42 var imagesloaded = new Array();
43 var maingalleries = new Array();
44 <!--(E)2 Gallery Parse XML output Javascript-->
45 HERE
46 ;
47
48
49 $footer = <<HERE
50 <!--End (E)2 Gallery Parse XML output Javascript-->
51 </script> <script type="text/javascript" src="e2gallerypro/js/e2gallerypro.js"></script>
52
53 <!--End (E)2 Gallery Javascript-->
54 <!--End (E)2 Gallery Pro </head> Files-->
55 </head>
56 <body>
57
58
59
60 <Title>
61 Judy Yates -- Wildlife and Pets on Stone
62 </title>
63
64 <span>
65 <img src = "./album_pics/3_logo.jpg">
66 </span>
67
68 <div class = "menu">
69 <ul class = "menu">
70 <li class = "menu"><a class = "menu" href = "index.html">Home</a></li>
71 <li class = "menu"><a class = "menu" href = "gallery1.html">Gallery</a></li>
72 <li class = "menu"><a class = "menu" href = "recent_sales.html">Prints</a></li>
73 <li class = "menu"><a class = "menu" href = "feedback.html">Feedback</a></li>
74 <li class = "menu"><a class = "menu" href = "hto.html">Orders</a></li>
75 <li class = "menu"><a class = "menu" href = "pricing.html">Pricing</a></li>
76 <li class = "menu"><a class = "menu" href = "Meet the Artist2.html"> Meet the Artist</a></li>
77 <li class = "menu"><a class = "menu" href = "Contact.html"> Contact</a></li>
78 <li class = "menu"><a class = "menu" href = "pets1.html">Pets</a></li>
79
80 </ul>
81 </div>
82
83 <div class = "orangebox">
84
85
86
87
88 <!--(E)2 Gallery Pro HTML-->
89 <div id="gallerywrapper">
90 <div id="gallery">
91 <!--Loading Bar-->
92 <div id="loading">
93 <div id="loadingbar"><img src="e2gallerypro/design/e2gallerypro/loading_hill.gif" width="50" height="50" alt="" id="bar" /></div>
94 </div>
95 <!--End Loading Bar-->
96 <!--Previous Button Div-->
97 <div id="previous"></div>
98
99 <!--End Previous Button Div-->
100 <!--Next Button Div-->
101 <div id="next"></div>
102 <!--End Next Button Div-->
103 <!--Main Image Holder Div-->
104 <div id="images">
105 <div id="imagewrap">
106 <div id="imgloader"></div>
107 </div>
108
109 <div id="imageinfo">
110 <div id="infoloader"></div>
111 </div>
112 <div id="smallmessage"></div>
113 </div>
114 <!--End Main Image Holder Div-->
115 <!--Thumb Box Div-->
116 <div id="thumbbox">
117 <div id="thumbleft"></div>
118
119 <div id="thumbright"></div>
120 <div id="thumbnails">
121 <div id="thumbnailwrap"></div>
122 </div>
123 </div>
124 <!--End Thumb Box Div-->
125 <!--For Sale Box Div-->
126 <div id="fsbox"></div>
127 <!--End For Sale Box Div-->
128
129 <!--Galleries Holder Div-->
130 <div id="galleries">
131 <div id="controls">
132 <div class="right"><img src="./e2gallerypro/design/e2gallerypro/gallery_view.png" class="controls" rel=" " id="opengallery" title="View Galleries" border="0" /> <img src="e2gallerypro/design/e2gallerypro/infobox.png" id="showinfo" rel=" " class="controls" title="View Info" border="0" /> <img src="e2gallerypro/design/e2gallerypro/thumbbox.png" id="showthumbbox" title="Toggle Thumbs" class="controls" rel=" " border="0" /></div>
133 <span id="slideshow"><img src="e2gallerypro/design/e2gallerypro/play.png" title="Play Slideshow" border="0" align="absmiddle" class="controls" rel=" " /></span> | <span id="photoNum"></span><span id="flashNum"></span><span id="qtNum"></span></div>
134 <div id="galleryset"> </div>
135
136 </div>
137 <!--End Galleries Holder Div-->
138 <!--Thumbnail Pop Up Holder-->
139 <div id="thumbnailPopUp"></div>
140 <!--End Thumbnail Pop Up Holder-->
141 </div>
142 </div>
143
144
145
146
147
148 </div>
149
150 <div class = "menu">
151 <ul class = "menu">
152 <li class = "menu"><a class = "menu" href = "index.html">Home</a></li>
153 <li class = "menu"><a class = "menu" href = "gallery1.html">Gallery</a></li>
154 <li class = "menu"><a class = "menu" href = "recent_sales.html">Prints</a></li>
155 <li class = "menu"><a class = "menu" href = "feedback.html">Feedback</a></li>
156 <li class = "menu"><a class = "menu" href = "hto.html">Orders</a></li>
157 <li class = "menu"><a class = "menu" href = "pricing.html">Pricing</a></li>
158 <li class = "menu"><a class = "menu" href = "Meet the Artist2.html"> Meet the Artist</a></li>
159 <li class = "menu"><a class = "menu" href = "Contact.html"> Contact</a></li>
160 <li class = "menu"><a class = "menu" href = "pets1.html">Pets</a></li>
161
162 </ul>
163 </div>
164
165
166 <div class = "copyright"><br><br>Copyright &copy 2007 Robert McIntyre. All pictures Copyright &copy Judy Yates.<br>Special thanks to Dylan Holmes for designing the main banner.</div>
167
168
169
170
171 </body>
172
173
174 </html>
175 HERE
176 ;
177
178
179
180 $pics = Set::Object->new();
181
182 open PHOTOS, '>/home/r/Desktop/web/judyates/photos.html';
183 select PHOTOS;
184
185
186 @include =
187 (
188 '/home/r/Desktop/web/judyates/e2gallerypro/e2upload/Galleries/photos/large'
189 );
190
191
192 find(\&accept_type,@include); #grab all the jpeg files
193
194 @pics = $pics->elements();
195
196 #@pics = shuffle(@pics);
197
198
199 foreach $id(0..$#pics)
200
201 {
202
203 $pics[$id] =~ m/(.*\/)([^\/]*)$/;
204 $lrgpath = $1;
205 $src = $2;
206 $lrgpath =~ m/^(.*\/)[^\/]*\/$/;
207 $path = $1;
208 $thumbPath = $path."thumbs/";
209 $filetype = "image";
210
211 ($width, $height) = imgsize($path.$src);
212
213 ($lrgwidth, $lrgheight) = imgsize($lrgpath.$src);
214
215
216 $title = $src;
217 $author = 'Judy Yates';
218 $copyright = 'Copyright Judy Yates Artist 2010';
219 $description = $src;
220 $forsale = "true";
221 $paytype ='paypal';
222
223
224 $price1 = '25';
225 $pricecurrency1 = 'USD';
226 $pricecurrencysymbol1 = '$';
227 $pricesize1 = '16inx20in';
228 $numOfPrices = 1;
229 $imgid = $id;
230
231
232 $megaString[$id]= "
233
234 {
235 'filetype' : '$filetype',
236 'path' : '$path',
237 'src' : '$src',
238 'width' : '$width',
239 'height' : '$height',
240 'lrgwidth' : '$lrgwidth',
241 'lrgheight' : '$lrgheight',
242 'lrgpath' : '$lrgpath',
243 'title' : '$title',
244 'author' : '$author',
245 'copyright' : '$copyright',
246 'description' : '$description',
247 'forsale' : $forsale,
248 'paytype' : '$paytype',
249 'price1' : '$price1',
250 'pricecurrency1' : '$pricecurrency1',
251 'pricecurrencysymbol1' : '$pricecurrencysymbol1',
252 'pricesize1' : '$pricesize1',
253 'numOfPrices' : '$numOfPrices',
254 'imgid' : $imgid,
255 },
256
257 ";
258
259 #print "@megaString";
260
261
262 #`$command2`;
263
264 }
265
266
267
268
269 $maingalleries = "
270 maingalleries =
271 [
272 {'name':'Judy Yates Photos',
273 'imgpath': '$path',
274 'lrgpath': '$lrgpath',
275 'thumbpath': '$thumbPath',
276 'mainthumb': '$path',
277 'src':'mainthumb.jpg',
278 'description':'Awesome Photos From Judy Yates.',
279 'start':0, 'end':$imgid,
280 'gallerynum':1}
281 ];
282
283
284 var galleryimages = new Array();
285
286 ";
287
288
289 print $header;
290
291
292 $maingalleries =~ s#/home/r/Desktop/web/judyates/#./#g;
293
294
295 print $maingalleries."\n";
296
297 print "galleryimages = [\n";
298
299 for (@megaString) {
300 s#/home/r/Desktop/web/judyates/#./#g;
301 print;}
302
303 print "\n];\n";
304
305 print $footer;
306
307
308
309
310
311
312
313 sub accept_type
314 {
315
316 /.svn$/ and $File::Find::prune = 1;
317
318 /.jpg$/i and $pics->insert($File::Find::name);
319
320
321
322
323 }
324