-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.php
More file actions
109 lines (100 loc) · 3.56 KB
/
admin.php
File metadata and controls
109 lines (100 loc) · 3.56 KB
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
<?php
session_start();
require_once "imgmgr.settings.php";
require_once "imgmgr.class.php";
if(isset($_GET['action']) && $_GET['action'] == "regenerate") {
imgmgr::deleteAllGeneratedImages($SETTINGS['pImageDirectory']);
imgmgr::crawlDirectoryForResize(
$SETTINGS['imageDirectory'],
$SETTINGS['pImageDirectory'],
$SETTINGS['imageTypes'],
$SETTINGS['resized'],
$SETTINGS['thumbnail'],
$SETTINGS['compressionQuality']
);
}
if(isset($_GET['action']) && $_GET['action'] == "generate") {
imgmgr::crawlDirectoryForResize(
$SETTINGS['imageDirectory'],
$SETTINGS['pImageDirectory'],
$SETTINGS['imageTypes'],
$SETTINGS['resized'],
$SETTINGS['thumbnail'],
$SETTINGS['compressionQuality'],
false);
}
if(isset($_GET['action']) && isset($_GET['album']) && $_GET['action'] == "delete") {
if(is_dir($SETTINGS['pImageDirectory'].$_GET['album'])) {
imgmgr::deleteAllGeneratedImages($SETTINGS['pImageDirectory'].$_GET['album']);
rmdir($SETTINGS['pImageDirectory'].$_GET['album']);
}
}
if(isset($_GET['album'])) {
$albumDir = $_GET['album'];
} else {
$albumDir = '';
}
?>
<!DOCTYPE html>
<html>
<head>
<title>imgmgr - admin</title>
<style type="text/css">
body { background-color: #EEE; font-family: Arial; }
#Main { width: 900px; margin: 20px auto; }
#Content { border: 1px solid #DDD; background-color: #FFF; padding: 15px 0 15px 25px; }
#Content h2 { font-size: 18px; }
ul#ImageList { margin: 0; padding: 0; }
ul#ImageList li { list-style: none; float: left; margin: 0 15px 15px 0; }
</style>
<link type="text/css" href="css/jquery.lightbox-0.5.css" rel="stylesheet" />
<script src="js/jquery.js" type="text/javascript"></script>
<script src="js/jquery.lightbox-0.5.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
$('#gallery a').lightBox(); // Select all links in object with gallery ID
// This, or...
$('a.lightbox').lightBox(); // Select all links with lightbox class
});
</script>
</head>
<body>
<div id="Main">
<header>
<h1>imgmgr - admin</h1>
</header>
<nav>
<ul>
<li><a href="?action=regenerate">Regenerate All Images from Originals</a><br /><span>This will delete all generated images</span></li>
<li><a href="?action=generate">Generate Images for new Albums (Folders)</a><br /><span>This will only look for new folders that have been added and generate images for them</span></li>
</ul>
</nav>
<div id="Content">
<?
// Provide a link to go up a level
if($albumDir != '') { echo "<a href=\"?album=".imgmgr::getParentDirectoryLink($albumDir)."\">Go Back</a>"; }
// Display a list of albums
if($albums = imgmgr::getAlbums($SETTINGS['pImageDirectory'].$albumDir)) {
echo "<h2>Albums</h2><ul id=\"FolderList\">";
foreach($albums as $album) {
echo "<li><a href=\"?album=".$albumDir.$album."/\">".$album."</a> - <a href=\"?action=delete&album=".$albumDir.$album."\">Delete</a></li>";
}
echo "</ul>";
}
if($images = imgmgr::getImages($SETTINGS['pImageDirectory'].$albumDir)) {
echo "<ul id=\"ImageList\">";
foreach($images as $image) {
$resizedImageFileName = substr($image, 10);
echo "<li><a class=\"lightbox\" href=\"".$SETTINGS['pImageDirectory'].$albumDir.$resizedImageFileName."\"><img src=\"".$SETTINGS['pImageDirectory'].$albumDir."/".$image."\" /></a></li>";
}
echo "</ul><div style=\"clear: both;\"></div>";
} else {
if($albumDir != '') {
echo "There are no pictures in this album.";
}
}
?>
</div>
</div>
</body>
</html>