korinovsky/yii2-app-gallery

Yii 2 图库模板

0.1 2016-04-11 08:19 UTC

This package is not auto-updated.

Last update: 2024-09-20 19:24:57 UTC


README

Yii 2 图库模板是一个轻量级的 Yii 2 应用程序框架,非常适合快速创建小型图库项目。

该模板包含了图库功能,包括用户登录/登出和联系方式页面。它包含了所有常用的配置,使您可以专注于添加新的功能到您的应用程序中。

Latest Stable Version Total Downloads Build Status

目录结构

  assets/             contains assets definition
  commands/           contains console commands (controllers)
  config/             contains application configurations
  controllers/        contains Web controller classes
  mail/               contains view files for e-mails
  models/             contains model classes
  runtime/            contains files generated during runtime
  tests/              contains various tests for the gallery application
  vendor/             contains dependent 3rd-party packages
  views/              contains view files for the Web application
  web/                contains the entry script and Web resources

要求

该模板对您Web服务器的最低要求是支持PHP 5.4.0。

安装

从存档文件安装

将从 github.com 下载的存档文件解压到Web根目录下的名为 gallery 的目录中。

config/web.php 文件中设置cookie验证密钥为某个随机密钥字符串

'request' => [
    // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
    'cookieValidationKey' => '<secret random string goes here>',
],

然后您可以通过以下URL访问应用程序

https:///gallery/web/

通过Composer安装

如果您没有 Composer,可以按照 getcomposer.org 上的说明进行安装。

然后可以使用以下命令安装此项目模板

php composer.phar global require "fxp/composer-asset-plugin:~1.1.1"
php composer.phar create-project --prefer-dist --stability=dev korinovsky/yii2-app-gallery gallery

现在,假设 gallery 是Web根目录下的目录,您应该可以通过以下URL访问应用程序。

https:///gallery/web/

配置

数据库

编辑 config/db.php 文件,使用真实数据,例如

return [
    'class' => 'yii\db\Connection',
    'dsn' => 'mysql:host=localhost;dbname=yii2gallery',
    'username' => 'root',
    'password' => '1234',
    'charset' => 'utf8',
];

备注

  • Yii不会为您创建数据库,您必须手动创建,然后才能访问它。
  • 检查并编辑 config/ 目录中的其他文件,以根据需要自定义您的应用程序。
  • 有关图库应用程序测试的特定信息,请参阅 tests 目录中的README。

\zxbodya\yii2-gallery-manager\GalleryBehavior:238

// orientation fix
if (($data = function_exists('exif_read_data') ? @exif_read_data($path) : null) && isset($data['Orientation']) && ($ort = $data['Orientation'])) {
    switch($ort)
    {
        case 1: { // nothing
            break;
        }
        case 2: { // horizontal flip
            $originalImage->flipHorizontally();
            break;
        }
        case 3: { // 180 rotate right
            $originalImage->rotate(180);
            break;
        }
        case 4: { // vertical flip
            $originalImage->flipVertically();
            break;
        }
        case 5: { // vertical flip + 90 rotate right
            $originalImage->flipVertically()->rotate(90);
            break;
        }
        case 6: { // 90 rotate right
            $originalImage->rotate(90);
            break;
        }
        case 7: { // horizontal flip + 90 rotate right
            $originalImage->flipHorizontally()->rotate(90);
            break;
        }
        case 8: { // 90 rotate left
            $originalImage->rotate(-90);
            break;
        }
    }
}