本文整理汇总了PHP中Storage::url方法的典型用法代码示例。如果您正苦于以下问题:PHP Storage::url方法的具体用法?PHP Storage::url怎么用?PHP Storage::url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Storage
的用法示例。
在下文中一共展示了Storage::url方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
// $test = base_path();
// dd($test);
$input = Input::only('title', 'tagline', 'summary', 'photo', 'content', 'published_at');
//form exceptions handled in start/global.php
$this->articleForm->validate($input);
// add user_id to the article create array
$article = array_add($input, 'user_id', Auth::id());
$article = Article::create($article);
if (Input::has('photo')) {
// upload photo to storage and set $article['photo'] to storage url
$filename = 'articles/photo-' . str_random(12);
Storage::upload(Input::file('photo'), $filename);
$article->photo = Storage::url($filename);
$article->save();
}
Session::flash('successMessage', "Added To Your Wolfpack: {$article->title}");
Log::info("New Article created at id: {$article->id}");
return Redirect::action('ArticlesController@index');
}
示例2: articles
public static function articles($sectionId)
{
$db = Core::getDb();
$content = null;
$articles = array();
$q = $db->buildQuery("select id from articles a LEFT JOIN objects o ON o.object_id=a.object_id where featured=true and visible=true and ctime<=now() and section_id=%d order by ctime desc limit 4", $sectionId);
$rs = $db->query($q);
if ($rs && ($count = $db->numRows($rs))) {
while ($o = $db->fetchObject($rs)) {
$article = new Article($o->id);
$articles[] = $article;
}
} else {
return $content;
}
$widths = array();
$widths[1] = array(780);
$widths[2] = array(520, 260);
$widths[3] = array(390, 195, 195);
$widths[4] = array(195, 195, 195, 195);
list($articles) = array_chunk($articles, 4);
$count = count($articles);
if (!$count) {
return null;
}
$content .= "<div class=\"banner\">\n";
foreach ($articles as $id => $article) {
$width = $widths[$count][$id];
$img = Storage::url($article->topImage());
list($base, $ext) = Storage::splitExtension($img);
$img = "{$base}.{$width}x250.c.{$ext}";
$content .= "<div class=\"bannerItem\" style=\"width: {$width}px; background-image: url({$img});\">\n";
$content .= "<a href=\"" . $article->url() . "\">" . $article->title() . "</a>";
$content .= "</div>\n";
}
$content .= "<br class=\"spacer\">";
$content .= "</div>\n";
return $content;
}
示例3: albumImage
public static function albumImage($id, $label, $albumId, $selected = 0)
{
$db = Core::getDb();
$template = new Template('forms/album-selectimage');
$imgUrl = $selected ? Storage::url($selected, 75, 75, true) : "/kiki/img/blank.gif";
$template->assign('label', $label);
$template->assign('imgUrl', $imgUrl);
$images = array();
$q = $db->buildQuery("select p.storage_id from pictures p, album_pictures ap where ap.picture_id=p.id AND ap.album_id=%d", $albumId);
$rs = $db->query($q);
if ($rs && $db->numRows($rs)) {
while ($o = $db->fetchObject($rs)) {
$url = Storage::url($o->storage_id, 75, 75, true);
$images[] = array('storageId' => $o->storage_id, 'url' => $url);
}
}
$template->assign('images', $images);
$template->assign('id', $id);
$template->assign('selected', $selected);
return $template->fetch();
}
示例4: content
public function content()
{
// rjkcust
setlocale("LC_TIME", "nl_NL.utf8");
$start = strftime("%A %e %B %Y %R", strtotime($this->start));
$end = strftime("%A %e %B %Y %R", strtotime($this->end));
$imgUrl = Storage::url($this->topImage(), 320, 180, true);
$content = "<img src=\"{$imgUrl}\" style=\"float: right; margin: 0 0 1em 1em;\">";
$content .= Misc::markup($this->description);
$content .= "<ul>";
$content .= "<li>Wanneer?<p class=\"small\">{$start} (over " . Misc::relativeTime($this->start) . ")</p></li>";
$content .= "<li>Waar?<p class=\"small\">" . $this->location . "</p></li>";
$this->loadPublications();
foreach ($this->publications as $publication) {
$content .= "<li><a href=\"" . $publication->url() . "\" class=\"button\"><span class=\"buttonImg " . $publication->service() . "\"></span>" . $publication->service() . "</a></li>\n";
}
$content .= "</ul>";
return $content;
}
示例5:
<div class="form-group">
<label for="titulo">Status</label>
<select name="status" class="form-control" id="status">
<option value="0" {{ $status=='0' ? 'selected' : '' }}>Bloqueado</option>
<option value="1" {{ $status=='1' ? 'selected' : '' }}>Liberado</option>
</select>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="imagem">
Imagem
<?php
if (isset($model) && $model->imagem) {
echo '<a href="' . Storage::url($model->imagem) . '" target="_new"><small>(ver)</small></a>';
}
?>
</label>
<input type="file" name="imagem" id="imagem" class="form-control">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="titulo">Título</label>
<input type="text" id="titulo" name="titulo" class="form-control" value="{{ $titulo }}" required>
</div>
</div>
</div>
示例6: formItem
public function formItem($pictureId)
{
// Picture details
$qPictureId = $this->db->escape($pictureId);
$q = "select storage_id from pictures where id={$qPictureId}";
$o = $this->db->getSingleObject($q);
$storageId = $o->storage_id;
$imgUrl = Storage::url($storageId, 75, 75, true);
return "<div class=\"pictureFormItem\" id=\"pictureFormItem_{$pictureId}\"><div class=\"img-overlay\"><a class=\"removePicture\" href=\"#\"><img src=\"/kiki/img/iconic/black/trash_stroke_16x16.png\" alt=\"Delete\"></a></div><img src=\"{$imgUrl}\" alt=\"\"></div>";
ob_start();
include Template::file('forms/album-editpicture');
$content = ob_get_contents();
ob_end_clean();
return $content;
}
示例7: list
<?php
/**
* Handles Ajax album navigation.
*
* @package Kiki
* @author Rob Kaper <http://robkaper.nl/>
* @copyright 2011 Rob Kaper <http://robkaper.nl/>
* @license Released under the terms of the MIT license.
*/
// include "../../lib/init.php";
list($dummy, $albumId) = explode("_", $_GET['album']);
$current = $_GET['current'];
$action = $_GET['action'];
if ($action == "navleft") {
$id = Album::findPrevious($albumId, $current);
} else {
$id = Album::findNext($albumId, $current);
}
$q = $db->buildQuery("select title, storage_id from pictures where id=%d", $id);
$o = $db->getSingleObject($q);
$response = array();
$response['id'] = $o ? $id : 0;
$response['title'] = $o ? $o->title : null;
$response['url'] = $o ? Storage::url($o->storage_id) : null;
$response['prev'] = Album::findPrevious($albumId, $id);
$response['next'] = Album::findNext($albumId, $id);
header('Content-type: application/json');
echo json_encode($response);
exit;
示例8: templateData
public function templateData()
{
$uAuthor = ObjectCache::getByType('\\Kiki\\User', $this->userId);
$prevArticle = $this->getPrev();
$nextArticle = $this->getNext();
$data = array('id' => $this->id, 'url' => $this->url(), 'ctime' => strtotime($this->ctime), 'relTime' => Misc::relativeTime($this->ctime), 'title' => $this->title, 'body' => $this->body, 'author' => $uAuthor->name(), 'images' => array(), 'publications' => array(), 'likes' => $this->likes(), 'comments' => Comments::count($this->objectId), 'html' => array('comments' => Comments::show($this->objectId), 'editform' => $this->form(true, 'articles')));
if ($nextArticle = $this->getNext()) {
$data['next'] = array('id' => $nextArticle->id(), 'url' => $nextArticle->url(), 'title' => $nextArticle->title());
}
if ($prevArticle = $this->getPrev()) {
$data['prev'] = array('id' => $prevArticle->id(), 'url' => $prevArticle->url(), 'title' => $prevArticle->title());
}
$publications = $this->publications();
foreach ($publications as $publication) {
$data['publications'][] = $publication->templateData();
}
$images = $this->images();
foreach ($images as $image) {
$data['images'][] = Storage::url($image);
}
// print_r( $data['images'] );
return $data;
}