【问题标题】:How can I use Yii2 Glide如何使用 Yii2 Glide
【发布时间】:2016-02-16 00:01:29
【问题描述】:

我已经在使用 yii2-file-kit。现在我想通过滑行调整缩略图的大小,但我在日志中出现错误

"NetworkError: 500 Internal Server Error - http://storage.local/cache/1/iApQj79NQCji2TWsLZppiCQ8lbdgAPBz.jpg?w=100"

这是我的配置

 'components' => [
    'cache' => [
        'class' => 'yii\caching\DummyCache',
    ],
'fileStorage' => [
        'class' => '\trntv\filekit\Storage',
        'baseUrl' => '@storageUrl/source',
        'filesystem' => [
            'class' => 'common\components\filesystem\LocalFlysystemBuilder',
            'path' => '@storage/web/source'
        ],
        'as log' => [
            'class' => 'common\behaviors\FileStorageLogBehavior',
            'component' => 'fileStorage'
        ]
    ],

    'glide' => [
        'class' => 'trntv\glide\components\Glide',
        'sourcePath' => '@storage/web/source',
        'cachePath' => '@storage/cache',
        'urlManager' => 'urlManagerStorage',
        'maxImageSize' => 4000000,
        'signKey' => 'pe4AJmRcBFbXfZvsk93VN'
    ],

在我看来

 <?= Html::img(
            Yii::$app->glide->createSignedUrl([
                'glide/index',
                'path' => $model->productAttachments[0]->path,
                'w' => 100
            ], true),
            ['class' => 'article-thumb img-rounded pull-left']
        ) ?>

我只是查看 Starter-Kit 配置,并且与我看到的配置相同。存储配置与 yii2-starter-kit 相同

【问题讨论】:

    标签: yii2 starter-kits


    【解决方案1】:

    您能否显示调试以获取更多信息。或者您可以通过以下方式输出图像 Url::base(true).'/glide?path='.$path.'&w='.$w.'&h='.$h.'&fit=crop';

    【讨论】:

      猜你喜欢
      • 2017-02-28
      • 2020-01-07
      • 1970-01-01
      • 2022-01-03
      • 1970-01-01
      • 1970-01-01
      • 2016-03-05
      • 1970-01-01
      • 2022-12-08
      相关资源
      最近更新 更多