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