annotate perl/make_gallery_js.pl @ 19:792475dd63f3 judyates

fixed problem with images not loadgin
author Robert McIntyre <rlm@mit.edu>
date Fri, 22 Jul 2011 13:43:55 -0400
parents b6ba604307fc
children
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@13 68
rlm@11 69 <div class = "menu">
rlm@11 70 <ul class = "menu">
rlm@15 71
rlm@15 72 <li class = "menu"><a class = "menu" href = "index.html">( Home</a></li>
rlm@15 73 <li class = "menu"><a class = "menu" href = "Meet the Artist2.html">Judy Yates</a></li>
rlm@15 74 <li class = "menu"><a class = "menu" href = "Contact.html">Contact )</a></li>
rlm@15 75 <li class = "menu"> <a class = "menu" href = "hto.html">( Custom Art</a></li>
rlm@11 76 <li class = "menu"><a class = "menu" href = "recent_sales.html">Prints</a></li>
rlm@15 77 <li class = "menu"><a class = "menu" href = "photos.html">Photos )</a></li>
rlm@15 78 <li class = "menu"><a class = "menu" href = "gallery1.html">( Gallery</a></li>
rlm@15 79 <li class = "menu"><a class = "menu" href = "pets1.html">Pets )</a></li>
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@15 152
rlm@15 153 <li class = "menu"><a class = "menu" href = "index.html">( Home</a></li>
rlm@15 154 <li class = "menu"><a class = "menu" href = "Meet the Artist2.html">Judy Yates</a></li>
rlm@15 155 <li class = "menu"><a class = "menu" href = "Contact.html">Contact )</a></li>
rlm@15 156 <li class = "menu"> <a class = "menu" href = "hto.html">( Custom Art</a></li>
rlm@11 157 <li class = "menu"><a class = "menu" href = "recent_sales.html">Prints</a></li>
rlm@15 158 <li class = "menu"><a class = "menu" href = "photos.html">Photos )</a></li>
rlm@15 159 <li class = "menu"><a class = "menu" href = "gallery1.html">( Gallery</a></li>
rlm@15 160 <li class = "menu"><a class = "menu" href = "pets1.html">Pets )</a></li>
rlm@11 161 </ul>
rlm@11 162 </div>
rlm@11 163
rlm@11 164 <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 165
rlm@11 166
rlm@11 167
rlm@11 168
rlm@11 169 </body>
rlm@11 170
rlm@11 171
rlm@11 172 </html>
rlm@11 173 HERE
rlm@11 174 ;
rlm@11 175
rlm@11 176
rlm@11 177
rlm@11 178 $pics = Set::Object->new();
rlm@11 179
rlm@11 180 open PHOTOS, '>/home/r/Desktop/web/judyates/photos.html';
rlm@11 181 select PHOTOS;
rlm@11 182
rlm@11 183
rlm@11 184 @include =
rlm@11 185 (
rlm@11 186 '/home/r/Desktop/web/judyates/e2gallerypro/e2upload/Galleries/photos/large'
rlm@11 187 );
rlm@11 188
rlm@11 189
rlm@11 190 find(\&accept_type,@include); #grab all the jpeg files
rlm@11 191
rlm@11 192 @pics = $pics->elements();
rlm@11 193
rlm@11 194 #@pics = shuffle(@pics);
rlm@11 195
rlm@11 196
rlm@11 197 foreach $id(0..$#pics)
rlm@11 198
rlm@11 199 {
rlm@11 200
rlm@11 201 $pics[$id] =~ m/(.*\/)([^\/]*)$/;
rlm@11 202 $lrgpath = $1;
rlm@11 203 $src = $2;
rlm@11 204 $lrgpath =~ m/^(.*\/)[^\/]*\/$/;
rlm@11 205 $path = $1;
rlm@11 206 $thumbPath = $path."thumbs/";
rlm@11 207 $filetype = "image";
rlm@11 208
rlm@11 209 ($width, $height) = imgsize($path.$src);
rlm@11 210
rlm@11 211 ($lrgwidth, $lrgheight) = imgsize($lrgpath.$src);
rlm@11 212
rlm@11 213
rlm@11 214 $title = $src;
rlm@11 215 $author = 'Judy Yates';
rlm@11 216 $copyright = 'Copyright Judy Yates Artist 2010';
rlm@11 217 $description = $src;
rlm@11 218 $forsale = "true";
rlm@11 219 $paytype ='paypal';
rlm@12 220 $ButtonID = "RAYAWZUUTJ79E";
rlm@11 221
rlm@11 222
rlm@12 223 $numOfPrices = 3;
rlm@12 224
rlm@11 225 $price1 = '25';
rlm@11 226 $pricecurrency1 = 'USD';
rlm@11 227 $pricecurrencysymbol1 = '$';
rlm@12 228 $pricesize1 = '8&quot;x10&quot; Photo Print';
rlm@12 229
rlm@12 230 $price2 = '35';
rlm@12 231 $pricecurrency2 = 'USD';
rlm@12 232 $pricecurrencysymbol2 = '$';
rlm@12 233 $pricesize2 = '11&quot;x14&quot; Matted Print';
rlm@12 234
rlm@12 235 $price3 = '40';
rlm@12 236 $pricecurrency3 = 'USD';
rlm@12 237 $pricecurrencysymbol3 = '$';
rlm@12 238 $pricesize3 = '11&quot;x14&quot; Signed Matt';
rlm@12 239
rlm@12 240
rlm@12 241
rlm@12 242
rlm@12 243
rlm@11 244 $imgid = $id;
rlm@11 245
rlm@11 246
rlm@11 247 $megaString[$id]= "
rlm@11 248
rlm@11 249 {
rlm@11 250 'filetype' : '$filetype',
rlm@12 251 'ButtonID' : '$ButtonID',
rlm@11 252 'path' : '$path',
rlm@11 253 'src' : '$src',
rlm@11 254 'width' : '$width',
rlm@11 255 'height' : '$height',
rlm@11 256 'lrgwidth' : '$lrgwidth',
rlm@11 257 'lrgheight' : '$lrgheight',
rlm@11 258 'lrgpath' : '$lrgpath',
rlm@11 259 'title' : '$title',
rlm@11 260 'author' : '$author',
rlm@11 261 'copyright' : '$copyright',
rlm@11 262 'description' : '$description',
rlm@11 263 'forsale' : $forsale,
rlm@11 264 'paytype' : '$paytype',
rlm@11 265 'price1' : '$price1',
rlm@11 266 'pricecurrency1' : '$pricecurrency1',
rlm@11 267 'pricecurrencysymbol1' : '$pricecurrencysymbol1',
rlm@11 268 'pricesize1' : '$pricesize1',
rlm@12 269
rlm@12 270 'price2' : '$price2',
rlm@12 271 'pricecurrency2' : '$pricecurrency2',
rlm@12 272 'pricecurrencysymbol2' : '$pricecurrencysymbol2',
rlm@12 273 'pricesize2' : '$pricesize2',
rlm@12 274
rlm@12 275 'price3' : '$price3',
rlm@12 276 'pricecurrency3' : '$pricecurrency3',
rlm@12 277 'pricecurrencysymbol3' : '$pricecurrencysymbol3',
rlm@12 278 'pricesize3' : '$pricesize3',
rlm@12 279
rlm@12 280
rlm@11 281 'numOfPrices' : '$numOfPrices',
rlm@11 282 'imgid' : $imgid,
rlm@11 283 },
rlm@11 284
rlm@11 285 ";
rlm@11 286
rlm@11 287 #print "@megaString";
rlm@11 288
rlm@11 289
rlm@11 290 #`$command2`;
rlm@11 291
rlm@11 292 }
rlm@11 293
rlm@11 294
rlm@11 295
rlm@11 296
rlm@11 297 $maingalleries = "
rlm@11 298 maingalleries =
rlm@11 299 [
rlm@11 300 {'name':'Judy Yates Photos',
rlm@11 301 'imgpath': '$path',
rlm@11 302 'lrgpath': '$lrgpath',
rlm@11 303 'thumbpath': '$thumbPath',
rlm@11 304 'mainthumb': '$path',
rlm@11 305 'src':'mainthumb.jpg',
rlm@11 306 'description':'Awesome Photos From Judy Yates.',
rlm@11 307 'start':0, 'end':$imgid,
rlm@11 308 'gallerynum':1}
rlm@11 309 ];
rlm@11 310
rlm@11 311
rlm@11 312 var galleryimages = new Array();
rlm@11 313
rlm@11 314 ";
rlm@11 315
rlm@11 316
rlm@11 317 print $header;
rlm@11 318
rlm@11 319
rlm@11 320 $maingalleries =~ s#/home/r/Desktop/web/judyates/#./#g;
rlm@11 321
rlm@11 322
rlm@11 323 print $maingalleries."\n";
rlm@11 324
rlm@11 325 print "galleryimages = [\n";
rlm@11 326
rlm@11 327 for (@megaString) {
rlm@11 328 s#/home/r/Desktop/web/judyates/#./#g;
rlm@11 329 print;}
rlm@11 330
rlm@11 331 print "\n];\n";
rlm@11 332
rlm@11 333 print $footer;
rlm@11 334
rlm@11 335
rlm@11 336
rlm@11 337
rlm@11 338
rlm@11 339
rlm@11 340
rlm@11 341 sub accept_type
rlm@11 342 {
rlm@11 343
rlm@11 344 /.svn$/ and $File::Find::prune = 1;
rlm@11 345
rlm@11 346 /.jpg$/i and $pics->insert($File::Find::name);
rlm@11 347
rlm@11 348
rlm@11 349
rlm@11 350
rlm@11 351 }
rlm@11 352