view perl/make_gallery_js.pl @ 12:2f433df9b961 judyates

[svn r13] Modified esgallery source to enable multiple paypal buttons; got the photo gallery operational and tested.
author rlm
date Mon, 12 Apr 2010 03:24:08 -0400
parents ed6ee381b8fd
children f16185fe9ed9
line wrap: on
line source
1 #!/usr/bin/perl
4 use File::Find;
5 use Set::Object;
6 use List::Util 'shuffle';
8 use Image::Size;
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" />
16 <title>Judy Yates - Prints</title>
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-->
24 <link href="firetest.css" rel="stylesheet" type="text/css" />
26 <link href="e2gallerypro/design/e2gallerypro/design.css" rel="stylesheet" type="text/css" />
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-->
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-->
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 ;
49 $footer = <<HERE
50 <!--End (E)2 Gallery Parse XML output Javascript-->
51 </script> <script type="text/javascript" src="e2gallerypro/js/e2gallerypro.js"></script>
53 <!--End (E)2 Gallery Javascript-->
54 <!--End (E)2 Gallery Pro </head> Files-->
55 </head>
56 <body>
60 <Title>
61 Judy Yates -- Wildlife and Pets on Stone
62 </title>
64 <span>
65 <img src = "./album_pics/3_logo.jpg">
66 </span>
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>
80 </ul>
81 </div>
83 <div class = "orangebox">
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>
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>
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>
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-->
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>
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>
148 </div>
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>
162 </ul>
163 </div>
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>
171 </body>
174 </html>
175 HERE
176 ;
180 $pics = Set::Object->new();
182 open PHOTOS, '>/home/r/Desktop/web/judyates/photos.html';
183 select PHOTOS;
186 @include =
187 (
188 '/home/r/Desktop/web/judyates/e2gallerypro/e2upload/Galleries/photos/large'
189 );
192 find(\&accept_type,@include); #grab all the jpeg files
194 @pics = $pics->elements();
196 #@pics = shuffle(@pics);
199 foreach $id(0..$#pics)
201 {
203 $pics[$id] =~ m/(.*\/)([^\/]*)$/;
204 $lrgpath = $1;
205 $src = $2;
206 $lrgpath =~ m/^(.*\/)[^\/]*\/$/;
207 $path = $1;
208 $thumbPath = $path."thumbs/";
209 $filetype = "image";
211 ($width, $height) = imgsize($path.$src);
213 ($lrgwidth, $lrgheight) = imgsize($lrgpath.$src);
216 $title = $src;
217 $author = 'Judy Yates';
218 $copyright = 'Copyright Judy Yates Artist 2010';
219 $description = $src;
220 $forsale = "true";
221 $paytype ='paypal';
222 $ButtonID = "RAYAWZUUTJ79E";
225 $numOfPrices = 3;
227 $price1 = '25';
228 $pricecurrency1 = 'USD';
229 $pricecurrencysymbol1 = '$';
230 $pricesize1 = '8&quot;x10&quot; Photo Print';
232 $price2 = '35';
233 $pricecurrency2 = 'USD';
234 $pricecurrencysymbol2 = '$';
235 $pricesize2 = '11&quot;x14&quot; Matted Print';
237 $price3 = '40';
238 $pricecurrency3 = 'USD';
239 $pricecurrencysymbol3 = '$';
240 $pricesize3 = '11&quot;x14&quot; Signed Matt';
246 $imgid = $id;
249 $megaString[$id]= "
251 {
252 'filetype' : '$filetype',
253 'ButtonID' : '$ButtonID',
254 'path' : '$path',
255 'src' : '$src',
256 'width' : '$width',
257 'height' : '$height',
258 'lrgwidth' : '$lrgwidth',
259 'lrgheight' : '$lrgheight',
260 'lrgpath' : '$lrgpath',
261 'title' : '$title',
262 'author' : '$author',
263 'copyright' : '$copyright',
264 'description' : '$description',
265 'forsale' : $forsale,
266 'paytype' : '$paytype',
267 'price1' : '$price1',
268 'pricecurrency1' : '$pricecurrency1',
269 'pricecurrencysymbol1' : '$pricecurrencysymbol1',
270 'pricesize1' : '$pricesize1',
272 'price2' : '$price2',
273 'pricecurrency2' : '$pricecurrency2',
274 'pricecurrencysymbol2' : '$pricecurrencysymbol2',
275 'pricesize2' : '$pricesize2',
277 'price3' : '$price3',
278 'pricecurrency3' : '$pricecurrency3',
279 'pricecurrencysymbol3' : '$pricecurrencysymbol3',
280 'pricesize3' : '$pricesize3',
283 'numOfPrices' : '$numOfPrices',
284 'imgid' : $imgid,
285 },
287 ";
289 #print "@megaString";
292 #`$command2`;
294 }
299 $maingalleries = "
300 maingalleries =
301 [
302 {'name':'Judy Yates Photos',
303 'imgpath': '$path',
304 'lrgpath': '$lrgpath',
305 'thumbpath': '$thumbPath',
306 'mainthumb': '$path',
307 'src':'mainthumb.jpg',
308 'description':'Awesome Photos From Judy Yates.',
309 'start':0, 'end':$imgid,
310 'gallerynum':1}
311 ];
314 var galleryimages = new Array();
316 ";
319 print $header;
322 $maingalleries =~ s#/home/r/Desktop/web/judyates/#./#g;
325 print $maingalleries."\n";
327 print "galleryimages = [\n";
329 for (@megaString) {
330 s#/home/r/Desktop/web/judyates/#./#g;
331 print;}
333 print "\n];\n";
335 print $footer;
343 sub accept_type
344 {
346 /.svn$/ and $File::Find::prune = 1;
348 /.jpg$/i and $pics->insert($File::Find::name);
353 }