本文整理汇总了PHP中Repository::findPathFromImages方法的典型用法代码示例。如果您正苦于以下问题:PHP Repository::findPathFromImages方法的具体用法?PHP Repository::findPathFromImages怎么用?PHP Repository::findPathFromImages使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Repository
的用法示例。
在下文中一共展示了Repository::findPathFromImages方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: listAction
public function listAction()
{
$notes = SqlRepository::getBooknotes();
$booknotes = array();
foreach ($notes as $note) {
$infos = array();
$infos['idx_href'] = '/article/list/' . $note->get_index_article_id();
$infos['image_path'] = Repository::findPathFromImages(array('eq' => array('image_id' => $note->get_image_id())));
$title = Repository::findTitleFromArticle(array('eq' => array('article_id' => $note->get_index_article_id())));
$infos['title'] = mb_substr($title, 0, 35);
$infos['descs'] = mb_substr($note->get_descs(), 0, 35);
$booknotes[] = $infos;
}
$params = array('infos' => $booknotes, 'title' => '读书笔记', 'category_id' => 2);
$this->display(__METHOD__, $params);
}
示例2: listAction
public function listAction()
{
if (!$this->is_root) {
header("Location: /index/notfound");
return;
}
$det_beg = empty($_GET['beg']) ? date('Y-m', time()) : $_GET['beg'];
$det_end = empty($_GET['end']) ? '2013-09' : $_GET['end'];
if ($det_beg > $det_end) {
list($det_beg, $det_end) = array($det_end, $det_beg);
}
$drw_beg = empty($_GET['drw_beg']) ? date('Y-m', time()) : $_GET['drw_beg'];
$drw_end = empty($_GET['drw_end']) ? '2013-09' : $_GET['drw_end'];
if ($drw_beg > $drw_end) {
list($drw_beg, $drw_end) = array($drw_end, $drw_beg);
}
$query = 'select * from earnings order by month desc limit 24';
$earnings = Repository::findFromEarnings(array('order' => array('month' => 'desc'), 'range' => array(0, 24)));
$earn_infos = array();
$month = array();
$income = array();
$expend = array();
$index = 0;
foreach ($earnings as $earning) {
$infos = array();
if ($earning->get_month() >= $det_beg and $earning->get_month() <= $det_end and $index < 12) {
$infos['idx_href'] = '/article/list/' . $earning->get_article_id();
$path = Repository::findPathFromImages(array('eq' => array('image_id' => $earning->get_image_id())));
$infos['image_path'] = $path;
$infos['title'] = $earning->get_month();
$infos['descs'] = '结余: ' . ($earning->get_income() - $earning->get_expend());
$earn_infos[] = $infos;
$index++;
}
if ($earning->get_month() >= $drw_beg and $earning->get_month() <= $drw_end) {
$month[] = $earning->get_month();
$income[] = $earning->get_income();
$expend[] = $earning->get_expend();
}
}
$average = round((array_sum($income) - array_sum($expend)) / count($month), 2);
$params = array('det_beg_month' => $det_beg, 'det_end_month' => $det_end, 'drw_beg_month' => $drw_beg, 'drw_end_month' => $drw_end, 'labels' => json_encode(array_reverse($month)), 'income' => json_encode(array_reverse($income)), 'expend' => json_encode(array_reverse($expend)), 'average' => $average, 'infos' => $earn_infos, 'category_id' => 1, 'title' => '龙潭财报');
$this->display('NoteController::listAction', $params);
}
示例3: getopt
<?php
require_once __DIR__ . '/../app/register.php';
LogOpt::init('earnings_loader', true);
$options = getopt('m:a:i:e:');
if (!isset($options['m']) || !isset($options['a']) || !isset($options['i']) || !isset($options['e'])) {
echo "useage: php earnings_loader.php -m month -a image_id" . " -i income -e expend (图片大小:400*345)" . PHP_EOL;
return;
}
$month = $options['m'];
$income = (double) $options['i'];
$expend = (double) $options['e'];
$image_id = (int) $options['a'];
$sql = 'select path from images where image_id = ' . $image_id;
$path = Repository::findPathFromImages(array('eq' => array('image_id' => $image_id)));
if ($path == false) {
LogOpt::set('exception', 'image_not_exists');
return false;
}
$article = new ArticleModel(array('title' => $month . '财报', 'updatetime' => 'now()', 'inserttime' => 'now()', 'draft' => '<div>' . PHP_EOL . '<!-- 图片大小:700*467 -->' . PHP_EOL . '</div>', 'category_id' => 6));
$article_id = Repository::persist($article);
if ($article_id == false) {
LogOpt::set('exception', 'new_note_insert_into_article_error');
return false;
}
LogOpt::set('info', 'new_note_insert_into_article_success', 'article_id', $article_id);
$infos = array();
$infos['article_id'] = $article_id;
$infos['image_id'] = $image_id;
$infos['month'] = $month;
$infos['income'] = $income;
示例4: pre_treat_article
//.........这里部分代码省略.........
}
}
} else {
if ($line == '<ol>' || $line == '<ul>') {
$contents .= $line;
while (1) {
$index++;
if ($index >= count($lines)) {
break;
}
$line = trim($lines[$index]);
if ($line == '</ol>' || $line == '</ul>') {
$contents .= $line;
break;
} else {
$line = self::str_trans($line);
if ($font != '') {
$line = '<span style="font-family:' . $font . ';">' . $line . '</span>';
}
$contents .= '<p><li>' . $line . '</li></p>';
}
}
} else {
if (substr($line, 0, 5) == '<font') {
$font = StringOpt::spider_string($line, '<font ', '>');
} else {
if ($line == '</font>') {
$font = '';
} else {
if (substr($line, 0, 4) == '<img') {
$id = StringOpt::spider_string($line, 'id="', '"');
if ($id != null) {
$image_id = intval(trim($id));
$path = Repository::findPathFromImages(array('eq' => array('image_id' => $image_id)));
if ($path != false) {
$line = str_replace('id="' . $id . '"', 'src="' . $path . '"', $line);
} else {
$line = '<strong>图片ID不存在</strong>';
}
} else {
$path = StringOpt::spider_string($line, 'src="', '"');
}
$image_info = GetImageSize(WEB_PATH . '/resource/' . $path);
$image_info = $image_info['3'];
$width = StringOpt::spider_string($image_info, 'width="', '"');
$width = intval(trim($width));
$contents .= '<p style="text-indent:0em;">' . '<a target="_blank" alt="' . $width . '" href="' . $path . '">' . $line . '</a></p><p> </p>';
} else {
if (substr($line, 0, 5) == '<code') {
$mode = StringOpt::spider_string($line, 'mode="', '"');
if (empty($mode)) {
$mode = 'c_cpp';
}
$code = '';
$code_line = 0;
$is_php = false;
if ($mode === 'php' && $lines[$index + 1] != '<?php') {
$is_php = true;
}
while (1) {
$index++;
if ($index >= count($lines)) {
break;
}
$line = $lines[$index];
if (trim($line) === '</code>') {