root/img/trunk/index.php

Revision 91, 2.6 kB (checked in by daniel, 4 months ago)

- Added: Upload multiple images at once

  • Property svn:keywords set to Id
Line 
1<?php
2/**
3 * @package img.pew.cc
4 * @author Daniel Triendl <daniel@pew.cc>
5 * @version $Id$
6 * @license http://opensource.org/licenses/agpl-v3.html
7 */
8
9/**
10 * img.pew.cc Image Hosting
11 * Copyright (C) 2009-2010  Daniel Triendl <daniel@pew.cc>
12 *
13 * This program is free software: you can redistribute it and/or modify
14 * it under the terms of the GNU Affero General Public License as
15 * published by the Free Software Foundation, either version 3 of the
16 * License, or (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 * GNU Affero General Public License for more details.
22 *
23 * You should have received a copy of the GNU Affero General Public License
24 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
25 */
26
27require_once('lib/init.php');
28
29$filetypes = '';
30foreach ($mime as $f) {
31    $filetypes .= $f . ', ';
32}
33$filetypes = substr($filetypes, 0, -2);
34
35$tagjs  = '<script src="js/jquery.tag.js" type="text/javascript"></script>';
36$tagjs .= '<script type="text/javascript">';
37$tagjs .= "$(function () {
38    $('#inputtags').attr('autocomplete', 'off');
39    $('#inputtags').tagSuggest({
40        url: 'tags.php',
41        delay: 250,
42        separator: ', ',
43        tagContainer: 'p',
44    });
45});
46
47$(document).ready(function () {
48    $('#addimage').click(function() {
49        $('#addimage').remove();
50        $('#inputimagecontainer').append('<span class=\"text\">&nbsp;</span><input type=\"file\" size=\"39\" name=\"image[]\" />&nbsp;' +
51            '<img src=\"images/add.png\" id=\"addimage\" alt=\"Add another image\" title=\"Add another image\" /><br /><br />');
52        $('#addimage').click(arguments.callee);
53    });
54});
55</script>";
56
57$content = '<form action="upload.php" method="post" enctype="multipart/form-data">
58            <div>
59            <input type="hidden" name="MAX_FILE_SIZE" value="' . $maxsize.'" />
60            <div id="inputimagecontainer">
61            <span class="text">File:</span><input type="file" size="39" name="image[]" />&nbsp;
62            <img src="images/add.png" id="addimage" alt="Add another image" title="Add another image" /><br /><br />
63            </div>
64            <span class="text">Tags:</span><input id="inputtags" type="text" size="39" name="tags" />
65            <span class="text">&nbsp;</span><input id="submit" type="submit" name="submit" value="Upload" />
66            <p id="info">
67                Maximum upload size: ' . byteConvert($maxsize) . '<br />
68                Allowed file types: ' . $filetypes . '<br />
69                Use , (comma) to seperate tags
70            </p>
71            <p id="browse"><a href="browse.php">Browse</a> | <a href="search.php">Search</a></p>
72            </div>
73            </form>';
74
75outputHTML($content, array('header' => $tagjs));
76
77?>
Note: See TracBrowser for help on using the browser.