Mercurial > judyates
view 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 |
line wrap: on
line source
1 #!/usr/bin/perl4 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 above30 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 HERE46 ;49 $footer = <<HERE50 <!--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 Stone62 </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 © 2007 Robert McIntyre. All pictures Copyright © Judy Yates.<br>Special thanks to Dylan Holmes for designing the main banner.</div>171 </body>174 </html>175 HERE176 ;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 files194 @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';224 $price1 = '25';225 $pricecurrency1 = 'USD';226 $pricecurrencysymbol1 = '$';227 $pricesize1 = '16inx20in';228 $numOfPrices = 1;229 $imgid = $id;232 $megaString[$id]= "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 },257 ";259 #print "@megaString";262 #`$command2`;264 }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 ];284 var galleryimages = new Array();286 ";289 print $header;292 $maingalleries =~ s#/home/r/Desktop/web/judyates/#./#g;295 print $maingalleries."\n";297 print "galleryimages = [\n";299 for (@megaString) {300 s#/home/r/Desktop/web/judyates/#./#g;301 print;}303 print "\n];\n";305 print $footer;313 sub accept_type314 {316 /.svn$/ and $File::Find::prune = 1;318 /.jpg$/i and $pics->insert($File::Find::name);323 }