Exemplo n.º 1
0
<?php

/**
 * Created by IntelliJ IDEA.
 * User: KNapret
 * Date: 02.12.2015
 * Time: 10:53
 */
createGallery('./pages/bilder/', 4, 300, 300);
function createGallery($srcdir, $n, $width, $height = null)
{
    $returnString = "<table><tbody><tr>";
    $bilder = glob($srcdir . '*.jpg');
    $counter = 0;
    foreach ($bilder as $value) {
        $returnString .= "<td><img src=" . $value . " width=" . $width . " height=" . $height . "></td>";
        $counter++;
        if ($counter == $n) {
            $returnString .= "</tr><tr>";
            $counter = 0;
        }
    }
    $returnString .= "</tr></tbody></table>";
    echo $returnString;
}
Exemplo n.º 2
0
    $output .= "</table>";
    $output .= "<?require_once 'footer.php';?>";
    // open the file
    $fhandle = fopen("{$galleryPage}", "w");
    // write the contents of the $output variable to the file
    fwrite($fhandle, $output);
    // close the file
    fclose($fhandle);
}
require_once "header.php";
echo "<form action='create_thumbs.php' method='post'>";
echo "Gallery Directory:<input type='text' name='search1' value=''>";
echo "Gallery Name:<input type='text' name='gallery' value=''>";
echo "<input type='submit' name='go' value='go' /><br>";
if (!isset($_POST['go'])) {
} else {
    $gallery = $_POST['gallery'] . ".php";
    // call createThumb function and pass to it as parameters the path
    // to the directory that contains images, the path to the directory
    // in which thumbnails will be placed and the thumbnail's width.
    // We are assuming that the path will be a relative path working
    // both in the filesystem, and through the web for links
    createThumbs("pics/" . $_POST['search1'] . "/", "thumbs/" . $_POST['search1'] . "/", 100);
    // call createGallery function and pass to it as parameters the path
    // to the directory that contains images and the path to the directory
    // in which thumbnails will be placed. We are assuming that
    // the path will be a relative path working
    // both in the filesystem, and through the web for links
    createGallery("pics/" . $_POST['search1'] . "/", "thumbs/" . $_POST['search1'] . "/", "{$gallery}");
}
require_once "footer.php";
Exemplo n.º 3
0
<?php

$gallery = createGallery('./bilder/', 7, 100);
echo $gallery;
function createGallery($srcdir, $n, $width, $height = null)
{
    $bilder = glob($srcdir . '*.jpg');
    // Array mit Bildern
    $string = "<table>";
    $string .= "<tbody>";
    $string .= "<tr>";
    $counter = 1;
    foreach ($bilder as $bild) {
        $string .= "<td>";
        $string .= "<img src='{$bild}' width='{$width}'>";
        $string .= "</td>";
        if ($counter++ == $n) {
            $counter = 1;
            $string .= '</tr><tr>';
        }
    }
    $string .= "</tr>";
    $string .= "</tbody>";
    $string .= "</table>";
    return $string;
}
Exemplo n.º 4
0
            echo "<tr><td></td></tr>";
        } else {
            echo "<tr><th colspan='2'><h3>" . $_FILES["new{$i}"]["name"] . "</h3></th>\n\t\t\t\t\t\t</tr><tr><td>Upload: </td><td>" . $_FILES["new{$i}"]["name"] . "</td></tr>";
            echo "<tr><td>Type: </td><td>" . $_FILES["new{$i}"]["type"] . "</td></tr>";
            if ($_FILES["new{$i}"]["size"] >= 1024000) {
                echo "<tr><td>File Size is Greater than 1 MB</td></tr>";
            } else {
                if (file_exists("Image/" . $_FILES["new{$i}"]["name"])) {
                    echo "<tr><td>" . $_FILES["new{$i}"]["name"] . " already exists. </td></tr>";
                } else {
                    if ($_FILES["new{$i}"]["size"] <= 0) {
                        echo "<tr><td>File Size is Too Low</td></tr>";
                    } else {
                        $g_pic = $_FILES["new{$i}"]["name"];
                        if ($i === 0) {
                            mysql_query("INSERT INTO gname(GName,Gpic) VALUES('" . $gallery_name . "','" . $g_pic . "')") or die(mysql_error());
                        }
                        move_uploaded_file($_FILES["new{$i}"]["tmp_name"], "Image/" . $_FILES["new{$i}"]["name"]);
                        echo "<tr><td>Size : </td><td>" . $_FILES["new{$i}"]["size"] / "1024" . " KB </td></tr>";
                        createThumbs("Image/", "Thumb/", 100);
                        createGallery("Image/", "Thumb/");
                    }
                }
            }
        }
    }
}
echo "<tr><td>Uploading Successfull See Gallery</td></tr></table></center>";
?>