本文整理汇总了PHP中Image::getFile方法的典型用法代码示例。如果您正苦于以下问题:PHP Image::getFile方法的具体用法?PHP Image::getFile怎么用?PHP Image::getFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Image
的用法示例。
在下文中一共展示了Image::getFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: readFolder
public function readFolder()
{
$folder = $this->customer->getFolderName();
$dir = DIR_IMAGE . "catalog/" . $folder;
$allfiles = scandir($dir);
$img_links = array();
$counting = 0;
foreach ($allfiles as $image) {
//if the file is not hidden get the the URI
if (substr($image, 0, 1) != '.') {
//Once we get certified the config.php needs to be modified.
$modify_image = new Image(DIR_IMAGE . "catalog/" . $folder . "/" . $image);
// $mark = new Image(DIR_IMAGE. "logo.png");
$width = $modify_image->getWidth() * 0.2;
$height = $modify_image->getHeight() * 0.2;
// $mark->resize($width, $height);
// $modify_image->watermark($mark);
$size = $width * $height;
$modify_image->save($modify_image->getFile());
$img_links[$counting]['source'] = HTTPS_SERVER . "/image/catalog/" . $folder . "/" . $image;
$img_links[$counting]['width'] = $modify_image->getWidth();
$img_links[$counting]['height'] = $modify_image->getHeight();
$counting++;
}
}
return $img_links;
}
示例2: run
public function run()
{
if ($image = CUploadedFile::getInstanceByName($this->field)) {
// Валидация по форме
$v = new ImageForm();
$v->image = true;
$v->image_file = $image;
if ($v->validate()) {
$preid = Yii::app()->request->getPost('preid', date('Ymd'));
$tmp = pathinfo($image->name);
$filename = EString::strtolower(EFile::sanitize($tmp['filename']) . '_' . uniqid() . '.' . $tmp['extension']);
$path = Yii::getPathOfAlias($this->folder . '.' . $this->field) . DIRECTORY_SEPARATOR . $preid . DIRECTORY_SEPARATOR;
$result = Image::addFile($image, $filename, $path, $this->sizes, $preid, null, $this->watermark ? Yii::app()->params['watermark'] : false);
echo '"' . Image::getFile($result, 'normal') . '"';
} else {
echo '{"error":"Файл не проходит валидацию, выберите другой."}';
}
} else {
echo '{"error":"Ошибка загрузки файла."}';
}
}
示例3: array
<?php
$this->breadcrumbs = array('Каталог шин' => array('tyres/index'), $producer->title => array('tyres/viewProducer', 'alias' => $producer->alias));
?>
<div class='span-18'>
<h2 class="title1"><span><span>Каталог шин</span></span></h2>
<ul>
<?php
foreach ($producer->tyres as $model) {
$photo = $model->photo ? Image::getFile($model->photo, 'small') : null;
?>
<li>
<?php
echo CHtml::link(CHtml::image($photo, $producer->title . ' ' . $model->title), array('tyres/viewModel', 'alias' => $model->alias, 'producerAlias' => $producer->alias));
?>
<?php
echo CHtml::link($model->title, array('tyres/viewModel', 'alias' => $model->alias, 'producerAlias' => $producer->alias));
?>
</li>
<?php
}
?>
</ul>
</div>
<div class='span-8 last'>
<h2 class="title1"><span><span>Подбор шин</span></span></h2>
<?php
$this->widget('widgets.producers.tyresWidget', array('model' => $tyreSelection));
?>
示例4: array
<?php
$this->breadcrumbs = array('Диски' => array('index'), $model->title);
$this->menu = array(array('label' => 'Обзор дисков', 'url' => array('index')), array('label' => 'Добавить диск', 'url' => array('create')), array('label' => 'Обновить диск', 'url' => array('update', 'id' => $model->id)), array('label' => 'Удалить диск', 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->id), 'confirm' => 'Вы уверены что хотите удалить диск?')), array('label' => 'Управление дисками', 'url' => array('admin')));
?>
<h1>Подробнее о диске #<?php
echo $model->id;
?>
</h1>
<?php
Yii::import('autocatalog.models.*');
$this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('id', array('name' => 'producer_id', 'type' => 'html', 'value' => CHtml::link($model->producer->title, array('disks/producers/view', 'id' => $model->producer_id))), 'title', 'alias', array('name' => 'photo', 'type' => 'image', 'value' => Image::getFile($model->photo, 'big')), 'description_marked:html', array('name' => 'new', 'value' => L::ruitem('boolean', $model->new)), array('name' => 'sale', 'value' => L::ruitem('boolean', $model->sale)), array('name' => 'construction_type', 'value' => L::item('diskConstructionType', $model->construction_type)), array('name' => 'color', 'value' => L::item('color', $model->color)), array('name' => 'model_id', 'type' => 'html', 'value' => $model->model ? CHtml::link($model->model->title, array('autocatalog/models/view', 'id' => $model->model_id)) : null), array('name' => 'sizes', 'type' => 'html', 'value' => $this->renderPartial('_sizes', array('sizes' => $model->sizes), true)))));
示例5:
?>
<br />
<b><?php
echo CHtml::encode($data->getAttributeLabel('title'));
?>
:</b>
<?php
echo CHtml::encode($data->title);
?>
<br />
<b><?php
echo CHtml::encode($data->getAttributeLabel('alias'));
?>
:</b>
<?php
echo CHtml::encode($data->alias);
?>
<br />
<b><?php
echo CHtml::encode($data->getAttributeLabel('logo'));
?>
:</b>
<?php
echo CHtml::image(Image::getFile($data->logo, 'normal'));
?>
<br />
</div>
示例6: foreach
if (!empty($models) && count($models) > 0) {
?>
<ul class='main-page-line'>
<?php
foreach ($models as $model) {
?>
<li>
<?php
if ($model->photo) {
?>
<a href='<?php
echo $model->url;
?>
'>
<img src='<?php
echo ($tmp = Image::getFile($model->photo, 'normal')) ? $tmp : 'http://carclub.ru' . $model->photo;
?>
' title='<?php
echo $model->title;
?>
' alt='Картинка: <?php
echo $model->title;
?>
' align='left' />
</a>
<?php
}
?>
<h3><?php
echo CHtml::link($model->title, $model->url);
?>
示例7: array
<?php
$params = array('catalog/tyres', 'aliasProducer' => $data->producer->alias, 'aliasModel' => $data->alias);
!empty($season) ? $params['season'] = $season : false;
!empty($stud) ? $params['stud'] = $stud : false;
echo CHtml::image(Image::getFile($data->photo, 'small'));
echo CHtml::link($data->title, $params);
?>
<Br />
示例8: array
<?php
$this->breadcrumbs = array('Шины' => array('index'), $model->title);
$this->menu = array(array('label' => 'Обзор шин', 'url' => array('index')), array('label' => 'Добавить шину', 'url' => array('create')), array('label' => 'Обновить шину', 'url' => array('update', 'id' => $model->id)), array('label' => 'Удалить шину', 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->id), 'confirm' => 'Вы уверены что хотите удалить шину?')), array('label' => 'Управление шинами', 'url' => array('admin')));
?>
<h1>Подробнее о шине #<?php
echo $model->id;
?>
</h1>
<?php
$this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('id', array('name' => 'producer_id', 'type' => 'html', 'value' => CHtml::link($model->producer->title, array('producers/tyres/view', 'id' => $model->producer_id))), 'title', 'alias', array('name' => 'photo', 'type' => 'image', 'value' => Image::getFile($model->photo, 'big')), 'description_marked:html', array('name' => 'new', 'value' => L::ruitem('boolean', $model->new)), array('name' => 'sale', 'value' => L::ruitem('boolean', $model->sale)), array('name' => 'currency', 'value' => L::item('tyreCurrency', $model->currency)), array('name' => 'season', 'value' => L::item('tyreSeason', $model->season)), array('name' => 'stud', 'value' => L::ruitem('boolean', $model->stud)), array('name' => 'construction_type', 'value' => L::item('tyreConstructionType', $model->construction_type)), array('name' => 'runflat_type', 'value' => L::ruitem('boolean', $model->runflat_type)), array('name' => 'sizes', 'type' => 'html', 'value' => $this->renderPartial('_sizes', array('sizes' => $model->sizes), true)))));
示例9: array
</div>
<div class="row">
<?php
echo $form->labelEx($model, 'alias');
?>
<?php
echo $form->textField($model, 'alias', array('size' => 45, 'maxlength' => 45));
?>
<?php
echo $form->error($model, 'alias');
?>
</div>
<?php
$this->widget('ext.uploader.uploader', array('model' => $model, 'name' => 'logo', 'options' => array('skin' => 'simple', 'allowDelete' => false, 'preview' => Image::getFile($model->logo, 'normal'))));
?>
<div class="row">
<?php
echo $form->labelEx($model, 'archive');
?>
<?php
echo $form->dropDownList($model, 'archive', L::items('ArchiveStatus'));
?>
<?php
echo $form->error($model, 'archive');
?>
</div>
<!--
示例10: array
$params = array('catalog/tyres', 'aliasProducer' => $data->alias);
!empty($season) ? $params['season'] = $season : false;
!empty($stud) ? $params['stud'] = $stud : false;
?>
<h3 class='grid_4 <?php
echo $index % 2 ? 'omega' : 'alpha';
?>
tcenter catalog-producers'>
<?php
if (!empty($data->logo)) {
?>
<div><a href='<?php
echo CHtml::normalizeUrl($params);
?>
'><?php
echo CHtml::image(Image::getFile($data->logo), 'Логотип производителя шин ' . $data->title, array('title' => 'Производитель шин ' . $data->title));
?>
</a></div>
<?php
} else {
?>
<?php
echo CHtml::link($data->title, $params);
?>
<?php
}
?>
</h3>
<?php
echo $index % 2 ? '<div class="clear"></div>' : '';
示例11: array
echo $this->id;
?>
'>
<?php
echo CHtml::activeFileField($this->model, $this->field, array('id' => $this->id . $this->field));
?>
<?php
if ($this->allowDelete && !empty($this->model->{$this->field})) {
?>
<input type='button' value='Удалить' onclick='$("#<?php
echo CHtml::ID_PREFIX;
echo $this->id . $this->field;
?>
").val("delete");$("#img<?php
echo $this->id . $this->field;
?>
").remove();'>
<?php
}
?>
<?php
if (!empty($this->model->{$this->field})) {
?>
<p><?php
echo CHtml::image(Image::getFile($this->model->{$this->field}, $this->defaultPreviewSize), '', array('id' => 'img' . $this->id . $this->field));
?>
</p>
<?php
}
?>
</div>
示例12: array
echo $model->id;
?>
-->
<h2><?php
echo $model->title;
?>
</h2>
<?php
echo EString::getBackTime($model->publicated);
$this->widget('widgets.comments.commentsCount', array('model' => $model));
?>
<hr />
<?php
echo $model->photo ? CHtml::image(Image::getFile($model->photo, 'main'), $model->title) : '';
echo $model->preamble_marked;
?>
<hr />
<?php
echo $model->text_marked;
?>
<hr />
<?php
$this->widget('widgets.socials.socials', array('model' => $model, 'options' => array('title' => $model->title, 'url' => CHtml::normalizeUrl(array('articles/view', 'alias' => $model->alias)), 'description' => CHtml::encode($model->preamble), 'printUrl' => CHtml::normalizeUrl(array('articles/print', 'alias' => $model->alias)))));
?>
<hr />
<?php
$this->widget('widgets.comments.comments', array('model' => $model));
示例13: array
<?php
$this->pageTitle = Yii::app()->name . ' - Каталог - Шины - ' . CHtml::encode($model->tyre->producer->title) . ' - ' . CHtml::encode($model->tyre->title) . ' - ' . CHtml::encode($model->size);
$this->breadcrumbs = array('Каталог' => array('catalog/index'), 'Шины' => array('catalog/tyres'), $model->tyre->producer->title => array('catalog/tyres', 'aliasProducer' => $model->tyre->producer->alias), $model->tyre->title => array('catalog/tyres', 'aliasProducer' => $model->tyre->producer->alias, 'aliasModel' => $model->tyre->alias), $model->size);
?>
<div class='grid_8 alpha catalog-card'>
<h2 class="title1"><span><span>Каталог шин</span></span></h2>
<div class='grid_2 alpha'>
<?php
$small = Image::getFile($model->tyre->photo, 'small');
$small = CHtml::image($small, 'Шина ' . CHtml::encode($model->tyre->producer->title . ' ' . $model->tyre->title));
if ($big = Image::getFile($model->tyre->photo, 'big')) {
echo CHtml::link($small, $big, array('class' => 'fancybox', 'title' => 'Шина ' . CHtml::encode($model->tyre->producer->title . ' ' . $model->tyre->title)));
} else {
echo $small;
}
?>
</div>
<div class='grid_6 omega item'>
<h3><?php
echo CHtml::encode($model->tyre->producer->title . ' ' . $model->tyre->title);
?>
</h3>
<div class='description'><?php
echo $model->tyre->description_marked;
?>
</div>
<?php
$this->widget('widgets.socials.socials', array('model' => $model, 'options' => array('title' => $model->title, 'url' => CHtml::normalizeUrl(array('articles/view', 'alias' => $model->alias)), 'description' => CHtml::encode($model->tyre->description), 'printUrl' => CHtml::normalizeUrl(array('articles/print', 'alias' => $model->alias)))));
示例14: array
<?php
$this->breadcrumbs = array('Менеджеры' => array('index'), $model->username);
$this->menu = array(array('label' => 'Добавить менеджера', 'url' => array('create')), array('label' => 'Обновить менеджера', 'url' => array('update', 'id' => $model->username)), array('label' => 'Удалить менеджера', 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->username), 'confirm' => 'Вы уверены что хотите удалить менеджера?')), array('label' => 'Управление менеджерами', 'url' => array('index')));
?>
<h1>Подробнее о менеджере #<?php
echo $model->username;
?>
</h1>
<?php
$this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('username', 'phone', 'email:email', 'priority', array('name' => 'avatar', 'type' => 'image', 'value' => $model->avatar ? Image::getFile($model->avatar) : null), 'online')));
示例15: array
<?php
$this->pageTitle = Yii::app()->name . ' - Профиль';
$this->breadcrumbs = array('Профиль');
?>
<div class='controls'>
<?php
echo CHtml::link('Редактировать профиль', array('users/edit', 'username' => $model->username));
?>
|
<?php
echo CHtml::link('Заказы', array('users/orders', 'username' => $model->username));
?>
</div>
<?php
$this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('username', 'email', array('name' => 'status', 'value' => L::ruitem('UserStatus', $model->status)), 'client.card', array('name' => 'client.discount', 'type' => 'raw', 'value' => $model->client ? ($model->client->discount ? $model->client->discount : '0') . '%' : null), array('name' => 'avatar', 'type' => 'image', 'value' => $model->avatar ? Image::getFile($model->avatar) : null), 'name', 'created', 'activated', 'birthday', array('name' => 'gender', 'value' => isset($model->gender) ? L::ruitem('gender', $model->gender) : null), 'last_login', 'client.phone', 'client.city', 'client.address')));