本文整理汇总了PHP中Configure::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Configure::where方法的具体用法?PHP Configure::where怎么用?PHP Configure::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Configure
的用法示例。
在下文中一共展示了Configure::where方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __getImage
private static function __getImage($img, $type)
{
$client = new Client(Config::get('services.dropbox.token'), Config::get('services.dropbox.appName'));
$fileSystem = new Filesystem(new DropboxAdapter($client, '/images/'));
$biggerW = $biggerH = false;
if ($img->width > $img->height) {
$biggerW = true;
} else {
$biggerH = true;
}
$image = $w = $h = null;
$public_path = public_path($img->path);
//code minh
//get image from dropbox
if ($img->store == 'dropbox') {
try {
$file = $fileSystem->read($img->path);
$public_path = $file;
} catch (Exception $e) {
return false;
}
}
//end code
if (in_array($type, ['with-logo', 'large-thumb'])) {
if ($biggerW) {
$w = 450;
} else {
$h = 450;
}
} else {
if (in_array($type, ['thumb', 'small-thumb'])) {
if ($type == 'thumb') {
if ($biggerW) {
$w = 150;
} else {
$h = 150;
}
} else {
if ($biggerW) {
$w = 100;
} else {
$h = 100;
}
}
} else {
if (in_array($type, ['crop', 'newcrop'])) {
$h = 300;
$w = 300;
if ($type == 'newcrop') {
$w = 600;
}
}
}
}
try {
if (in_array($type, ['crop', 'newcrop'])) {
$image = Image::make($public_path)->fit($w, $h, function ($constraint) {
$constraint->aspectRatio();
});
} else {
$image = Image::make($public_path)->resize($w, $h, function ($constraint) {
$constraint->aspectRatio();
});
}
} catch (Exception $e) {
return false;
}
if ($type == 'with-logo') {
if (Cache::has('mask')) {
$mask = Cache::get('mask');
} else {
$mask = Configure::where('ckey', 'mask')->pluck('cvalue');
if (empty($mask)) {
$mask = 'Visual Impact';
}
Cache::forever('mask', $mask);
}
$size = 50;
$w = $image->width();
$h = $image->height();
$x = round($w / 2);
$y = round($h / 2);
$img = Image::canvas($w, $h);
$string = wordwrap($mask, 15, '|');
$strings = explode('|', $string);
$line = 2;
$i = round($y - count($strings) / 2 * ($size + $line));
$from = $i - 20;
foreach ($strings as $string) {
$draw = new \ImagickDraw();
$draw->setStrokeAntialias(true);
$draw->setTextAntialias(true);
$draw->setFont(public_path('assets' . DS . 'fonts' . DS . 'times.ttf'));
$draw->setFontSize($size);
$draw->setFillColor('rgb(0, 0, 0)');
$draw->setFillOpacity(0.2);
$draw->setTextAlignment(\Imagick::ALIGN_CENTER);
$draw->setStrokeColor('#fff');
$draw->setStrokeOpacity(0.2);
$draw->setStrokeWidth(1);
//.........这里部分代码省略.........