当前位置: 首页>>代码示例>>PHP>>正文


PHP Gallery::setPath方法代码示例

本文整理汇总了PHP中Gallery::setPath方法的典型用法代码示例。如果您正苦于以下问题:PHP Gallery::setPath方法的具体用法?PHP Gallery::setPath怎么用?PHP Gallery::setPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gallery的用法示例。


在下文中一共展示了Gallery::setPath方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Gallery

<?php

require 'includes/gallery.php';
$gallery = new Gallery();
$gallery->setPath('gallery/includes/uploads');
$images = $gallery->getImages(array('jpg'));
?>

<html>
<head>
	<title>Image Gallery</title>
	<link rel="stylesheet" href="assets/css/gallery.css">
</head>
<body>
	<form action="upload.php" method="post" enctype="multipart/form-data">
		<input type="file" name="file">
		<input type="submit" value="upload">
	</form>

	<div class="container">
		<?php 
if ($images) {
    ?>
			<div class="gallery clearfix">
				<?php 
    foreach ($images as $image) {
        ?>
					<div class="gallery-item">
						<a href="<?php 
        echo $image['full'];
        ?>
开发者ID:shep1990,项目名称:PHP-Gallery,代码行数:31,代码来源:index.php

示例2: Gallery

<?php

require 'gallery.php';
$gallery = new Gallery();
$gallery->setPath('img');
//path to the image folder
$images = $gallery->getImages(array('JPG', 'PNG', 'jpg'));
//array of possible image extensions (useful if you have mixed galleries)
$row_counter = 0;
//don't change that
$img_no_caption = " ";
//default caption for image that don't have one
$img_no_date = $page_title = "PHP-Gallery";
//changes the <title> attribute AND the logo in top left corner
$no_images_warning = "Ooops! No images in gallery!";
//Display the text when $gallery->setPath directory is empty.
$col_md_x = 6;
//Bootstrap - choose either 2,3,4 or 6 to have 6,4,3 or 2 pics per line respectively
//----------------------------------------------
$row_x = 12 / $col_md_x;
?>

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title><?php 
echo $page_title;
?>
</title>
    <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
开发者ID:kho226,项目名称:PHP_gallery,代码行数:31,代码来源:index.php

示例3: User

<?php

require_once 'core/init.php';
header('Content-Type: text/html; charset=utf-8');
header("Content-Security-Policy: script-src 'self'");
header('Strict-Transport-Security: max-age=3600');
$user = new User();
if ($user->isLoggedIn()) {
    $db = DB::getInstance();
    $gallery = new Gallery();
    $gallery->setPath('static/images/');
    $images = $gallery->getImages();
    $imageUploadErrors = array();
    if (Input::exists()) {
        if ($_FILES) {
            //Getting the form that the image was posted from
            $postingForm = $gallery->getPosition($_FILES);
            $uplImage = $_FILES[$postingForm];
            //Changing the filename to the name of the form that it was posted from
            $filename = $postingForm . '.jpg';
            $targetPath = "static/images/" . $filename;
            if (!move_uploaded_file($uplImage['tmp_name'], $targetPath)) {
                $imageUploadErrors[] = "Error code " . $uplImage['error'] . ". Please try again.";
            }
            $pathToImages = "static/images/";
            $pathToThumbs = "static/images/thumbnails/";
            if ($gallery->createThumbnail($pathToImages, $pathToThumbs, 256)) {
                $imageUploadErrors[] = "Successfully made thumbnail.";
            } else {
                $imageUploadErrors[] = "Something went wrong.";
            }
开发者ID:simpa2k,项目名称:vilde,代码行数:31,代码来源:admin.php

示例4: Gallery

<?php

require_once 'core/init.php';
// Setting header
header('Content-Type: text/html; charset=utf-8');
header("Content-Security-Policy: script-src 'self'");
header('Strict-Transport-Security: max-age=3600');
$gallery = new Gallery();
if ($_GET) {
    $gallery->setPath('static/images/' . $_GET['folder']);
} else {
    Redirect::to('/');
}
$images = $gallery->getImages(array('jpg'));
?>

<!DOCTYPE html>
<html>
    <head>
        <title><?php 
echo $_GET['folder'];
?>
</title>
        <link rel="stylesheet" href="static/css/gallery.css">
    </head>
    <body>
        <div id="background"></div>
        
        <div id="main">
            <?php 
if ($images) {
开发者ID:simpa2k,项目名称:vilde,代码行数:31,代码来源:gallery.php


注:本文中的Gallery::setPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。