Mercurial > judyates
diff 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 diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/perl/make_gallery_js.pl Mon Apr 12 02:31:43 2010 -0400 1.3 @@ -0,0 +1,324 @@ 1.4 +#!/usr/bin/perl 1.5 + 1.6 + 1.7 +use File::Find; 1.8 +use Set::Object; 1.9 +use List::Util 'shuffle'; 1.10 + 1.11 +use Image::Size; 1.12 + 1.13 +$header = <<HERE; 1.14 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 1.15 +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 1.16 +<head> 1.17 + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 1.18 + 1.19 + <title>Judy Yates - Prints</title> 1.20 + 1.21 + 1.22 + <!--(E)2 Gallery Pro <head> Files--> 1.23 + <!--(E)2 Gallery Config FIle--> 1.24 + <!--End (E)2 Gallery Config FIle--> 1.25 + <!--(E)2 Gallery Style Sheet Link--> 1.26 + 1.27 + <link href="firetest.css" rel="stylesheet" type="text/css" /> 1.28 + 1.29 + <link href="e2gallerypro/design/e2gallerypro/design.css" rel="stylesheet" type="text/css" /> 1.30 + 1.31 + <script type="text/javascript"> 1.32 + //modify this path if needed ^ Correlates with Style Sheet Path above 1.33 + var designPath="e2gallerypro/design/e2gallerypro/"; 1.34 + </script> 1.35 + <!--End (E)2 Gallery Style Sheet Link--> 1.36 + 1.37 + <!--Mootools--> 1.38 + <script type="text/javascript" src="e2gallerypro/js/mootools-1.2-core.js"></script> 1.39 + <script type="text/javascript" src="e2gallerypro/js/mootools-1.2-more.js"></script> 1.40 + <!--End Mootools--> 1.41 + <!--(E)2 Gallery Javascript--> 1.42 + 1.43 + <script type="text/javascript" src="e2gallerypro/js/setupvars.js"></script> 1.44 + <script type="text/javascript"> 1.45 +var imagesloaded = new Array(); 1.46 +var maingalleries = new Array(); 1.47 +<!--(E)2 Gallery Parse XML output Javascript--> 1.48 +HERE 1.49 +; 1.50 + 1.51 + 1.52 +$footer = <<HERE 1.53 +<!--End (E)2 Gallery Parse XML output Javascript--> 1.54 +</script> <script type="text/javascript" src="e2gallerypro/js/e2gallerypro.js"></script> 1.55 + 1.56 + <!--End (E)2 Gallery Javascript--> 1.57 + <!--End (E)2 Gallery Pro </head> Files--> 1.58 +</head> 1.59 +<body> 1.60 + 1.61 + 1.62 + 1.63 +<Title> 1.64 +Judy Yates -- Wildlife and Pets on Stone 1.65 +</title> 1.66 + 1.67 +<span> 1.68 +<img src = "./album_pics/3_logo.jpg"> 1.69 +</span> 1.70 + 1.71 +<div class = "menu"> 1.72 +<ul class = "menu"> 1.73 +<li class = "menu"><a class = "menu" href = "index.html">Home</a></li> 1.74 +<li class = "menu"><a class = "menu" href = "gallery1.html">Gallery</a></li> 1.75 +<li class = "menu"><a class = "menu" href = "recent_sales.html">Prints</a></li> 1.76 +<li class = "menu"><a class = "menu" href = "feedback.html">Feedback</a></li> 1.77 +<li class = "menu"><a class = "menu" href = "hto.html">Orders</a></li> 1.78 +<li class = "menu"><a class = "menu" href = "pricing.html">Pricing</a></li> 1.79 +<li class = "menu"><a class = "menu" href = "Meet the Artist2.html"> Meet the Artist</a></li> 1.80 +<li class = "menu"><a class = "menu" href = "Contact.html"> Contact</a></li> 1.81 +<li class = "menu"><a class = "menu" href = "pets1.html">Pets</a></li> 1.82 + 1.83 +</ul> 1.84 +</div> 1.85 + 1.86 +<div class = "orangebox"> 1.87 + 1.88 + 1.89 + 1.90 + 1.91 +<!--(E)2 Gallery Pro HTML--> 1.92 +<div id="gallerywrapper"> 1.93 + <div id="gallery"> 1.94 + <!--Loading Bar--> 1.95 + <div id="loading"> 1.96 + <div id="loadingbar"><img src="e2gallerypro/design/e2gallerypro/loading_hill.gif" width="50" height="50" alt="" id="bar" /></div> 1.97 + </div> 1.98 + <!--End Loading Bar--> 1.99 + <!--Previous Button Div--> 1.100 + <div id="previous"></div> 1.101 + 1.102 + <!--End Previous Button Div--> 1.103 + <!--Next Button Div--> 1.104 + <div id="next"></div> 1.105 + <!--End Next Button Div--> 1.106 + <!--Main Image Holder Div--> 1.107 + <div id="images"> 1.108 + <div id="imagewrap"> 1.109 + <div id="imgloader"></div> 1.110 + </div> 1.111 + 1.112 + <div id="imageinfo"> 1.113 + <div id="infoloader"></div> 1.114 + </div> 1.115 + <div id="smallmessage"></div> 1.116 + </div> 1.117 + <!--End Main Image Holder Div--> 1.118 + <!--Thumb Box Div--> 1.119 + <div id="thumbbox"> 1.120 + <div id="thumbleft"></div> 1.121 + 1.122 + <div id="thumbright"></div> 1.123 + <div id="thumbnails"> 1.124 + <div id="thumbnailwrap"></div> 1.125 + </div> 1.126 + </div> 1.127 + <!--End Thumb Box Div--> 1.128 + <!--For Sale Box Div--> 1.129 + <div id="fsbox"></div> 1.130 + <!--End For Sale Box Div--> 1.131 + 1.132 + <!--Galleries Holder Div--> 1.133 + <div id="galleries"> 1.134 + <div id="controls"> 1.135 + <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> 1.136 + <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> 1.137 + <div id="galleryset"> </div> 1.138 + 1.139 + </div> 1.140 + <!--End Galleries Holder Div--> 1.141 + <!--Thumbnail Pop Up Holder--> 1.142 + <div id="thumbnailPopUp"></div> 1.143 + <!--End Thumbnail Pop Up Holder--> 1.144 + </div> 1.145 +</div> 1.146 + 1.147 + 1.148 + 1.149 + 1.150 + 1.151 +</div> 1.152 + 1.153 +<div class = "menu"> 1.154 +<ul class = "menu"> 1.155 +<li class = "menu"><a class = "menu" href = "index.html">Home</a></li> 1.156 +<li class = "menu"><a class = "menu" href = "gallery1.html">Gallery</a></li> 1.157 +<li class = "menu"><a class = "menu" href = "recent_sales.html">Prints</a></li> 1.158 +<li class = "menu"><a class = "menu" href = "feedback.html">Feedback</a></li> 1.159 +<li class = "menu"><a class = "menu" href = "hto.html">Orders</a></li> 1.160 +<li class = "menu"><a class = "menu" href = "pricing.html">Pricing</a></li> 1.161 +<li class = "menu"><a class = "menu" href = "Meet the Artist2.html"> Meet the Artist</a></li> 1.162 +<li class = "menu"><a class = "menu" href = "Contact.html"> Contact</a></li> 1.163 +<li class = "menu"><a class = "menu" href = "pets1.html">Pets</a></li> 1.164 + 1.165 +</ul> 1.166 +</div> 1.167 + 1.168 + 1.169 +<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> 1.170 + 1.171 + 1.172 + 1.173 + 1.174 +</body> 1.175 + 1.176 + 1.177 +</html> 1.178 +HERE 1.179 +; 1.180 + 1.181 + 1.182 + 1.183 +$pics = Set::Object->new(); 1.184 + 1.185 +open PHOTOS, '>/home/r/Desktop/web/judyates/photos.html'; 1.186 +select PHOTOS; 1.187 + 1.188 + 1.189 +@include = 1.190 +( 1.191 +'/home/r/Desktop/web/judyates/e2gallerypro/e2upload/Galleries/photos/large' 1.192 +); 1.193 + 1.194 + 1.195 +find(\&accept_type,@include); #grab all the jpeg files 1.196 + 1.197 +@pics = $pics->elements(); 1.198 + 1.199 +#@pics = shuffle(@pics); 1.200 + 1.201 + 1.202 +foreach $id(0..$#pics) 1.203 + 1.204 +{ 1.205 + 1.206 +$pics[$id] =~ m/(.*\/)([^\/]*)$/; 1.207 +$lrgpath = $1; 1.208 +$src = $2; 1.209 +$lrgpath =~ m/^(.*\/)[^\/]*\/$/; 1.210 +$path = $1; 1.211 +$thumbPath = $path."thumbs/"; 1.212 +$filetype = "image"; 1.213 + 1.214 +($width, $height) = imgsize($path.$src); 1.215 + 1.216 +($lrgwidth, $lrgheight) = imgsize($lrgpath.$src); 1.217 + 1.218 + 1.219 +$title = $src; 1.220 +$author = 'Judy Yates'; 1.221 +$copyright = 'Copyright Judy Yates Artist 2010'; 1.222 +$description = $src; 1.223 +$forsale = "true"; 1.224 +$paytype ='paypal'; 1.225 + 1.226 + 1.227 +$price1 = '25'; 1.228 +$pricecurrency1 = 'USD'; 1.229 +$pricecurrencysymbol1 = '$'; 1.230 +$pricesize1 = '16inx20in'; 1.231 +$numOfPrices = 1; 1.232 +$imgid = $id; 1.233 + 1.234 + 1.235 +$megaString[$id]= " 1.236 + 1.237 + { 1.238 + 'filetype' : '$filetype', 1.239 + 'path' : '$path', 1.240 + 'src' : '$src', 1.241 + 'width' : '$width', 1.242 + 'height' : '$height', 1.243 + 'lrgwidth' : '$lrgwidth', 1.244 + 'lrgheight' : '$lrgheight', 1.245 + 'lrgpath' : '$lrgpath', 1.246 + 'title' : '$title', 1.247 + 'author' : '$author', 1.248 + 'copyright' : '$copyright', 1.249 + 'description' : '$description', 1.250 + 'forsale' : $forsale, 1.251 + 'paytype' : '$paytype', 1.252 + 'price1' : '$price1', 1.253 + 'pricecurrency1' : '$pricecurrency1', 1.254 + 'pricecurrencysymbol1' : '$pricecurrencysymbol1', 1.255 + 'pricesize1' : '$pricesize1', 1.256 + 'numOfPrices' : '$numOfPrices', 1.257 + 'imgid' : $imgid, 1.258 + }, 1.259 + 1.260 +"; 1.261 + 1.262 +#print "@megaString"; 1.263 + 1.264 + 1.265 +#`$command2`; 1.266 + 1.267 +} 1.268 + 1.269 + 1.270 + 1.271 + 1.272 +$maingalleries = " 1.273 +maingalleries = 1.274 +[ 1.275 +{'name':'Judy Yates Photos', 1.276 +'imgpath': '$path', 1.277 +'lrgpath': '$lrgpath', 1.278 +'thumbpath': '$thumbPath', 1.279 +'mainthumb': '$path', 1.280 +'src':'mainthumb.jpg', 1.281 +'description':'Awesome Photos From Judy Yates.', 1.282 +'start':0, 'end':$imgid, 1.283 +'gallerynum':1} 1.284 +]; 1.285 + 1.286 + 1.287 +var galleryimages = new Array(); 1.288 + 1.289 +"; 1.290 + 1.291 + 1.292 +print $header; 1.293 + 1.294 + 1.295 +$maingalleries =~ s#/home/r/Desktop/web/judyates/#./#g; 1.296 + 1.297 + 1.298 +print $maingalleries."\n"; 1.299 + 1.300 +print "galleryimages = [\n"; 1.301 + 1.302 +for (@megaString) { 1.303 + s#/home/r/Desktop/web/judyates/#./#g; 1.304 + print;} 1.305 + 1.306 +print "\n];\n"; 1.307 + 1.308 +print $footer; 1.309 + 1.310 + 1.311 + 1.312 + 1.313 + 1.314 + 1.315 + 1.316 +sub accept_type 1.317 +{ 1.318 + 1.319 +/.svn$/ and $File::Find::prune = 1; 1.320 + 1.321 +/.jpg$/i and $pics->insert($File::Find::name); 1.322 + 1.323 + 1.324 + 1.325 + 1.326 +} 1.327 +