-
Notifications
You must be signed in to change notification settings - Fork 0
/
GalleryWall.php
219 lines (180 loc) · 6.84 KB
/
GalleryWall.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<?php
// Location of the XML file on the file system
$file = 'pics.xml';
$xml = simplexml_load_file($file);
/* Configuration Start */
$thumb_directory = 'img/thumbs';
$orig_directory = 'img/original';
$stage_width = 800;
// How big is the area the images are scattered on
$stage_height = 350;
/* Configuration end */
$allowed_types = array('jpg', 'jpeg', 'gif', 'png');
$file_parts = array();
$ext = '';
$title = '';
$i = 0;
$tagarray = array('comics', 'blogs', 'news', 'radio');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Typejs" content="text/html; charset=utf-8" />
<title>Personality Wall</title>
<link rel="stylesheet" type="text/css" href="css/wall.css" />
<link rel="stylesheet" type="text/css" href="css/buttons.css" />
<link rel="stylesheet"
href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/themes/ui-darkness/jquery-ui.css"
type="text/css" media="all" />
<link rel="stylesheet" type="text/css"
href="fancybox/jquery.fancybox-1.3.4.css" />
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js"></script>
<script type="text/javascript" src="fancybox/jquery-css-transform.js"></script>
<script type="text/javascript"
src="fancybox/jquery-animate-css-rotate-scale.js"></script>
<script type="text/javascript"
src="fancybox/jquery.fancybox-1.3.4.pack.js"></script>
<script type="text/javascript"
src="./fancybox/jquery.mousewheel-3.0.4.pack.js"></script>
<script type="text/javascript" src="wallbasic.js"></script>
<script type="text/javascript" src="wallfunctions.js"></script>
<script type="text/javascript">
var stage_width = <?php echo $stage_width ?> ;
var stage_height = <?php echo $stage_height ?> ;
var list = [<?php foreach ($tagarray as $i => $value) {echo '\'.'.$value.'\','; };?>];
$(document).ready(function () {
shuffle();
$(".fancybox").fancybox({
transitionIn: 'elastic',
transitionOut: 'elastic',
titlePosition: 'inside',
showNavArrows: false,
centerOnScroll: true,
hideOnContentClick: true,
//onComplete: resize
});
$('#shuffleText').click(shuffle);
$('#sortText').click(sort);
$('#gridText').click(grid);
$('#gridSortText').click(gridSort);
$('#browseText').click(browse);
});
</script>
</head>
<body>
<div id="main">
<h1 style="float: left">Personality Wall</h1>
<div style="text-align: right; float: right">
<h3>Drag and click on the pictures to view</h3>
<p>
<a id="inline" class="fancybox" href="#info">Information</a> | <a
id="inline" class="fancybox" href="#resources">Resources</a> | <a
id="inline" " class="fancybox" href="#changes">Changes</a>
</p>
</div>
<!-- Stuff for the Inline Displays -->
<div style="display: none;">
<div id="info" class="inline">
<p>This can be used to represent a personality. Each item has a description and link which can be used to give more information. <br> The generate XML page generates the xml from the imgs directory. The XML file holds the information about each item.</p>
</div>
<div id="resources" class="inline">
<p>
<b><u>Here are some of the resources I used:</u> </b>
</p>
<ul>
<li><a href="http://www.cssbuttongenerator.com/" target="_blank">CSS
Button Generator</a> to create the buttons!</li>
<li><a
href="http://tutorialzine.com/2009/11/hovering-gallery-css3-jquery/"
target="_blank">Tutorial Zine</a> as a base to create this page.</li>
<li><a
href="http://www.marcofolio.net/webdesign/the_polaroid_photo_viewer_non-full_screen.html"
target="_blank">Marco Kuiper's Polaroid Example</a> helped with
some rotation errors.</li>
<li><a href="http://www.w3schools.com" target="_blank">W3Schools</a>
for help when my knowledge of CSS/Javascript/HTML needed a little
review!</li>
<li><a href="http://fancybox.net/" target="_blank">FancyBox</a>
for the modal windows.</li>
<li><a href="http://php.net/manual/en/book.simplexml.php"
target="_blank">SimpleXML Manual</a> for making the XML aspects.</li>
<li><a href="http://jsbeautifier.org/" target="_blank"> JS
Beautifier</a> for help on making the code look pretty.</li>
</ul>
</div>
<div id="changes" class="inline">
<p>
<b><u>Recent Changes:</u> </b>
</p>
<ul>
<li>Removed click triggers when not in browse mode</li>
</ul>
</div>
</div>
<table style="margin-left: auto; margin-right: auto;"
class="text_line">
<tr>
<td>
<div id="shuffleText" class="myButton">Shuffle</div>
</td>
<td>
<div id="sortText" class="myButton">Sort</div>
</td>
<td>
<div id="gridText" class="myButton">Grid</div>
</td>
<td>
<div id="gridSortText" class="myButton">Grid Sort</div>
</td>
<td>
<div id="browseText" class="myButton">Browse</div>
</td>
</tr>
</table>
<div id="gallery">
<?php
/* Opening the thumbnail directory and looping through all the thumbs: */
$dir_handle = @opendir($thumb_directory) or die("There is an error with the image directory!");
$i = 1;
foreach($xml->picture as $node) {
$file = $node->filename;
$description = $node->description;
$link = $node->link;
$tags = $node->tags;
//echo $file;
/* Skipping the system files: */
if($file=='.' || $file == '..') continue;
$file_parts = explode('.',$file);
$ext = strtolower(array_pop($file_parts));
/* Using the file name (without the extension) as a image title: */
$title = implode('.',$file_parts);
$title = htmlspecialchars($title);
/* If the file extension is allowed: */
if(in_array($ext,$allowed_types))
{
/* Outputting each image: */
$descriptionAndLink = $description." <a href=".$link."\ target=_blank> Link </a>";
echo '
<div id="pic-'.($i++).'" class="pic '.$tags.'" style="background:url('.$thumb_directory.'/'.$file.') no-repeat 50% 50%;">
<a title="'.$descriptionAndLink.'"
onclick="javascript: this.title=\''.$descriptionAndLink.'\';"
onMouseOver="javascript: this.title=\''.$description.'\';"
onMouseOut="javascript: this.title=\''.$descriptionAndLink.'\';"
class="fancybox" rel="fncbx" href="'.$orig_directory.'/'.$file.'" target="_blank"></a>
</div>';
}
}
foreach ($tagarray as $i => $value) {
echo '<div id="pic" title="'.$value.'" class="pic cover '.$value.'Cover '.$value.'" style="display:none;background:url('.$thumb_directory.'/CoverEmpty.jpg) no-repeat 50% 50%;">
<br>'.$value.'
</div>';
}
/* Closing the directory */
closedir($dir_handle);
?>
</div>
</body>
</html>