-
Notifications
You must be signed in to change notification settings - Fork 0
/
createThumbnail.php
45 lines (43 loc) · 1.03 KB
/
createThumbnail.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
<?php
if (isset($_POST['create'])) {
require_once('/app/Classes/Thumbnail.php');
try {
$thumb = new Thumbnail($_POST['pix']);
$thumb->setDestination('C:/WebHost/htdocs/skolaverkefni/Verkefni5/uploads/thumbnails/');
$thumb->setMaxSize(100);
$thumb->setSuffix('small');
$thumb->create();
$messages = $thumb->getMessages();
$thumb->test();
} catch (Exception $e) {
echo $e->getMessage();
}
}
?>
<?php
if (isset($messages) && !empty($messages)) {
echo '<ul>';
foreach ($messages as $message) {
echo "<li>$message</li>";
}
echo '</ul>';
}
?>
<form id="form1" name="form1" method="post" action="">
<p>
<select name="pix" id="pix">
<option value="">Select an image</option>
<?php
$files = new DirectoryIterator('../uploads');
$images = new RegexIterator($files, '/\.(?:jpg|png|gif)$/i');
foreach ($images as $image) {
?>
<option value="../uploads/<?php echo $image; ?>">
<?php echo $image; ?></option>
<?php } ?>
</select>
</p>
<p>
<input type="submit" name="create" id="create" value="Create Thumbnail">
</p>
</form>