本文整理汇总了PHP中Image::url方法的典型用法代码示例。如果您正苦于以下问题:PHP Image::url方法的具体用法?PHP Image::url怎么用?PHP Image::url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Image
的用法示例。
在下文中一共展示了Image::url方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAvatar
public function getAvatar($size = 100)
{
if (empty($this->entity->logo)) {
return \Theme::asset()->img('theme/images/game/logo.jpg');
}
return \Image::url($this->entity->logo, $size);
}
示例2: render
public function render($path, $param = [], $setting = [])
{
$predefinedSettings = ['title' => $this->setTitle()];
if ($this->exists()) {
$predefinedSettings = array_merge($predefinedSettings, ['design' => $this->community->present()->readDesign()]);
}
$settings = array_merge($predefinedSettings, $setting);
if (\Config::get('page-design') and isset($settings['design'])) {
extract($settings['design']);
$bgImage = !empty($bg_image) ? 'background-image:url(' . \Image::url($bg_image) . ');' : null;
$this->theme->asset()->afterStyleContent("\n body{\n " . $bgImage . "\n background-position: " . $bg_position . ";\n background-color: " . $bg_color . ";\n background-repeat: " . $bg_repeat . ";\n background-attachment : " . $bg_attachment . ";\n }\n\n a {\n color : " . $link_color . ";\n }\n\n .page-content{\n background-color: " . $content_bg_color . ";\n }\n ");
}
return parent::render('community.page.layout', ['content' => $this->theme->section($path, $param)], $settings);
}
示例3: update
public function update(Image $image)
{
$query = $this->_db->prepare(' UPDATE t_image SET
name=:name, url=:url, description=:description, idProjet=:idProjet, updated=:updated, updatedBy=:updatedBy
WHERE id=:id') or die(print_r($this->_db->errorInfo()));
$query->bindValue(':id', $image->id());
$query->bindValue(':name', $image->name());
$query->bindValue(':url', $image->url());
$query->bindValue(':description', $image->description());
$query->bindValue(':idProjet', $image->idProjet());
$query->bindValue(':updated', $image->updated());
$query->bindValue(':updatedBy', $image->updatedBy());
$query->execute();
$query->closeCursor();
}
示例4: uploadBg
/**
* Ajax serving
*/
public function uploadBg()
{
$error = json_encode(['response' => 0, 'message' => trans('photo.error', ['size' => formatBytes()])]);
if (\Request::hasFile('image')) {
if (!$this->photoRepository->imagesMetSizes(\Input::file('image'))) {
return $error;
}
if ($image = $this->userRepository->changeDesignBg(\Input::file('image'), \Input::get('val.bg_image'))) {
return json_encode(['response' => 1, 'image' => \Image::url($image), 'imagePath' => $image]);
} else {
return $error;
}
}
return $error;
}
示例5: changePhoto
public function changePhoto()
{
$id = \Input::get('id');
$game = $this->gameRepository->get($id);
$response = ['code' => 0, 'message' => trans('photo.error', ['size' => formatBytes()]), 'url' => ''];
if (\Request::hasFile('image')) {
if (!$this->photoRepository->imagesMetSizes(\Input::file('image'))) {
return json_encode($response);
}
$image = $this->gameRepository->changePhoto(\Input::file('image'), $game);
if ($image) {
$response['code'] = 1;
$response['url'] = \Image::url($image, 100);
}
}
return json_encode($response);
}
示例6: render
public function render($path, $param = [], $setting = [])
{
$predefinedSettings = [];
if (\Auth::check()) {
/**
* If there is login we help this user to design his page
*/
$predefinedSettings = array_merge($predefinedSettings, ['design' => \Auth::user()->present()->readDesign()]);
}
$settings = array_merge($predefinedSettings, $setting);
if (\Config::get('page-design') and isset($settings['design'])) {
extract($settings['design']);
$bgImage = !empty($bg_image) ? 'background-image:url(' . \Image::url($bg_image) . ');' : 'background-image : none';
$this->theme->asset()->afterStyleContent("\n body{\n " . $bgImage . "\n background-position: " . $bg_position . ";\n background-color: " . $bg_color . ";\n background-repeat: " . $bg_repeat . ";\n background-attachment : " . $bg_attachment . ";\n }\n\n a {\n color : " . $link_color . ";\n }\n\n .page-content{\n background-color: " . $content_bg_color . ";\n }\n ");
}
return parent::render($path, $param, $settings);
}
示例7: cropCover
public function cropCover($id)
{
$top = \Input::get('top');
$failed = json_encode(['status' => 'error', 'message' => trans('photo.error', ['size' => formatBytes()])]);
$page = $this->pageRepository->get($id);
if (!$page or !$page->isOwner()) {
return $failed;
}
$image = $this->photo->cropImage(base_path($page->original_cover), 'cover/', 0, abs($top), 1000, 300, false);
$image = str_replace('%d', 'original', $image->result());
if (!empty($image)) {
/**
* Update user profile cover
*/
if ($page->cover and $page->cover != $page->original_cover) {
\Image::delete($page->cover);
}
$page->cover = $image;
$page->save();
return json_encode(['status' => 'success', 'url' => \Image::url($image)]);
} else {
return json_encode(['status' => 'error', 'message' => 'Error things']);
}
}
示例8: testServeWrongFormat
public function testServeWrongFormat()
{
$url = Image::url('/wrong.jpg', 300, 300, array('crop' => true));
$this->setExpectedException('Folklore\\Image\\Exception\\FormatException');
$response = $this->call('GET', $url);
}
示例9: cropCover
public function cropCover()
{
$top = \Input::get('imgY1');
$left = \Input::get('imgX1');
$cWidth = \Input::get('cropW');
$cHeight = \Input::get('cropH');
$file = \Input::get('imgUrl');
$file = str_replace([\URL::to(''), '//'], ['', '/'], $file);
$id = \Input::get('id');
$image = $this->photo->cropImage(base_path('') . $file, 'cover/', $left, $top, $cWidth, $cHeight, false);
$image = str_replace('%d', 'original', $image->result());
/**make sure to delete the original image***/
$this->photo->delete($file);
if (!empty($image)) {
/**
* Update user profile cover
*/
$this->eventRepository->updateCover($id, $image);
return json_encode(['status' => 'success', 'url' => \Image::url($image)]);
} else {
return json_encode(['status' => 'error', 'message' => 'Error ']);
}
}
示例10:
@if ($user)
<div class="col-xs-12">
<div class="alert alert-info">Add new image by clicking on the + icon on the left sidebar.</div>
<div class="grid">
<div class="grid-sizer"></div>
@foreach($images as $image)
<div class="grid-item {{ $image['status'] }}" data-id="{{ $image['id'] }}" data-status="{{ $image['status'] }}"
data-preview="<?php
echo Image::url('/uploads/images/' . $image['path'], 400);
?>
">
<img src="<?php
echo Image::url('/uploads/images/' . $image['path'], 200, 300);
?>
"/>
</div>
@endforeach
</div>
</div>
@else
<div class="col-xs-12">
<div class="well" style="background-color: #fff">
<p>We use the OCR capability of Google Drive to perform the image to text conversion of your documents. Thus we need you to sign in using your Google Account and grant access to your Google Drive for performing the OCR.</p>
示例11: uploadImage
public function uploadImage()
{
$result = ['code' => 0, 'message' => trans('post.post-image-error')];
if ($image = \Input::file('image')) {
$uploadImage = $this->postRepository->uploadImage($image);
if ($uploadImage) {
$result['image'] = $uploadImage;
$result['imageurl'] = \Image::url($uploadImage, 100);
$result['code'] = 1;
}
}
return json_encode($result);
}
示例12: getLogo
public function getLogo()
{
if (empty($this->entity->logo)) {
return \Theme::asset()->img('theme/images/community/cover.jpg');
}
return \Image::url($this->entity->logo);
}
示例13: readDesign
public function readDesign($type = 'profile')
{
$design = ['enable' => false];
$userDesign = !empty($this->entity->design_info) ? perfectUnserialize($this->entity->design_info) : [];
$userDesign = !$userDesign ? [] : $userDesign;
$design = array_merge($design, $userDesign);
if (isset($design[$type])) {
$design = $design[$type];
}
/**
* @var $enable
* @var $theme
*/
extract($design);
if ($enable) {
$design['bg_image'] = \Image::url($design['bg_image']);
}
if (!$enable) {
$themeDesign = \Theme::option()->get('design-themes');
$themeDesign = (empty($theme) or !isset($themeDesign[$theme])) ? $themeDesign['default'] : $themeDesign[$theme];
/**
* Reset the design to this selected one
*/
$design['bg_image'] = $themeDesign['background-image'];
$design['bg_color'] = $themeDesign['background-color'];
$design['bg_attachment'] = $themeDesign['background-attachment'];
$design['bg_position'] = $themeDesign['background-position'];
$design['bg_repeat'] = $themeDesign['background-repeat'];
$design['link_color'] = $themeDesign['link-color'];
$design['content_bg_color'] = $themeDesign['page-content-bg-color'];
}
return $design;
}
示例14: cropCover
public function cropCover()
{
$top = \Input::get('top');
$image = $this->photo->cropImage(base_path(\Auth::getUser()->original_cover), 'cover/', 0, abs($top), 1000, 300, false);
$image = str_replace('%d', 'original', $image->result());
if (!empty($image)) {
/**
* Update user profile cover
*/
$user = \Auth::user();
if ($user->cover and $user->cover != $user->original_cover) {
\Image::delete($user->cover);
}
$this->userRepository->updateCover($image);
return json_encode(['status' => 'success', 'url' => \Image::url($image)]);
} else {
return json_encode(['status' => 'error', 'message' => 'Error things']);
}
}
示例15: coverImage
public function coverImage()
{
if (!empty($this->entity->cover)) {
return \Image::url($this->entity->cover);
}
}