本文整理匯總了PHP中scaleImg函數的典型用法代碼示例。如果您正苦於以下問題:PHP scaleImg函數的具體用法?PHP scaleImg怎麽用?PHP scaleImg使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了scaleImg函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: actSaveDriver
function actSaveDriver()
{
global $ST, $post, $get;
$id = $post->getInt('id');
$data = array('name' => $post->get('name'), 'phone' => $post->get('phone'), 'car' => $post->get('car'), 'img' => $post->get('img'), 'img_car' => $post->get('img_car'), 'state' => $post->getInt('state'));
if ($data['img'] == 'clear') {
$data['img'] = '';
} elseif (isset($_FILES['img_upload']) && $_FILES['img_upload']['name']) {
$name = md5_file($_FILES['img_upload']['tmp_name']) . '.' . file_ext($_FILES['img_upload']['name']);
$data['img'] = $path = '/' . DRIVERS_IMG_PATH . '/' . $name;
move_uploaded_file($_FILES['img_upload']['tmp_name'], ROOT . $path);
$out['img'] = scaleImg($path, 'w100h100');
}
if ($data['img_car'] == 'clear') {
$data['img_car'] = '';
} elseif (isset($_FILES['img_car_upload']) && $_FILES['img_car_upload']['name']) {
$name = md5_file($_FILES['img_car_upload']['tmp_name']) . '.' . file_ext($_FILES['img_car_upload']['name']);
$data['img_car'] = $path = '/' . DRIVERS_IMG_PATH . '/' . $name;
move_uploaded_file($_FILES['img_car_upload']['tmp_name'], ROOT . $path);
$out['img_car'] = scaleImg($path, 'w100h100');
}
if ($id) {
$ST->update('sc_shop_waybill_driver', $data, "id=" . $id);
} else {
$id = $ST->insert('sc_shop_waybill_driver', $data);
}
$out['id'] = $id;
$out['msg'] = 'Сохранено';
echo printJSONP($out, $get->get('cb'));
exit;
}
示例2: actSave
function actSave()
{
global $post;
$id = $post->getInt('u_id');
$data = array('login' => $post->get('login'), 'status' => $post->get('status'), 'name' => $post->get('name'), 'company' => $post->get('company'), 'phone' => $post->get('phone'), 'city' => $post->get('city'), 'address' => $post->get('address'), 'mail' => $post->get('mail'), 'avat' => $post->get('avat'), 'balance' => $post->getFloat('balance'), 'discount' => $post->getFloat('discount'), 'hide' => 0, 'type' => $post->get('type'));
$password = $post->remove('password');
$avat_path = $post->remove('avat_path');
$msg = 'Сохранено';
$img_out = "";
if (!empty($_FILES['upload']['name']) && isImg($_FILES['upload']['name'])) {
$img = $this->cfg('AVATAR_PATH') . '/' . md5($_FILES['upload']['tmp_name']) . "." . file_ext($_FILES['upload']['name']);
move_uploaded_file($_FILES['upload']['tmp_name'], ROOT . $img);
$data['avat'] = $img;
$img_out = scaleImg($img, 'w200');
}
if ($post->getInt('clear')) {
$data['avat'] = '';
}
$err = array();
$rs = DB::select("SELECT * FROM sc_users WHERE login='" . SQL::slashes($post->get('login')) . "' AND u_id<>{$id}");
if ($rs->next()) {
$err['login'] = 'Пользователь существует';
}
if (!$err) {
if ($id === 0) {
$data[] = "password=MD5('" . trim($password) . "')";
$id = DB::insert('sc_users', $data, 'u_id');
} else {
if (trim($password)) {
$data[] = "password=MD5('" . trim($password) . "')";
}
DB::update('sc_users', $data, 'u_id=' . $id);
}
echo printJSONP(array('msg' => $msg, 'u_id' => $id, 'img' => $img_out));
exit;
} else {
echo printJSONP(array('err' => $err));
exit;
}
}
示例3: scaleImg
<td><input name="position" value="<?php
echo $position;
?>
" class="input-text" style="width:40px"/><br /></td>
</tr>
<tr>
<th>Краткое описание</th>
<td><textarea name="description" class="input-text"><?php
echo $description;
?>
</textarea></td>
</tr>
<tr><th>Изображение : </th>
<td>
<img id="img-file" src="<?php
echo $img ? scaleImg($img, 'w200') : '/img/no_image.png';
?>
"/><br/>
<input type="file" name="upload"> <input type="checkbox" name="clear" value="1"><label>Удалить</label>
</td>
</tr>
<tr>
<td colspan="2">
<textarea class="tiny" name="content" style="width:100%;height:300px"><?php
echo $content;
?>
</textarea>
</td>
</tr>
<tr>
<th>Похожие статьи</th>
示例4: foreach
<?php
$i = 0;
foreach ($rs as $row) {
?>
<td>
<?php
$row['img'] = $row['img'] ? $row['img'] : $this->cfg('NO_IMG');
?>
<?php
if (trim($row['img'])) {
?>
<a href="/catalog/action/<?php
echo $row['id'];
?>
/"><img src="<?php
echo scaleImg($row['img'], 'w580');
?>
"></a><?php
}
?>
<div class="item">
<a class="header" href="/catalog/action/<?php
echo $row['id'];
?>
/" title="Подробнее..."><?php
echo $row['title'];
?>
</a>
<div class="date">С <?php
echo fdte1($row['date']);
示例5: actSave
function actSave()
{
global $ST, $get, $post;
$id = $post->getInt('id');
$data = array('content' => $post->get('content'), 'description' => $post->get('description'), 'title' => $post->get('title'), 'author' => $post->get('author'), 'date' => dte($post->get('date'), 'Y-m-d'), 'state' => $post->get('state'), 'category' => $post->getInt('category'), 'position' => $post->getInt('position'), 'gallery' => $post->getInt('gallery'), 'type' => $this->getType());
$img_out = "";
if (!empty($_FILES['upload']['name']) && isImg($_FILES['upload']['name'])) {
$img = $this->cfg('NEWS_IMAGE_PATH') . '/' . md5($_FILES['upload']['tmp_name']) . "." . file_ext($_FILES['upload']['name']);
move_uploaded_file($_FILES['upload']['tmp_name'], ROOT . $img);
$data['img'] = $img;
$img_out = scaleImg($img, 'w200');
}
if ($post->getInt('clear')) {
$data['img'] = '';
}
if ($id) {
$ST->update('sc_news', $data, "id=" . $id);
} else {
$id = $ST->insert('sc_news', $data);
}
$ST->delete('sc_relation', "parent={$id} AND type='public'");
foreach ($post->getArray('public_rel') as $v) {
$ST->insert('sc_relation', array('parent' => $id, 'type' => 'public', 'child' => $v));
}
$msg = "Сохранено";
if (true) {
$content = '';
$content .= '<small>' . date('d.m.Y') . '</small> ';
$content .= '<strong>' . $post->getHtml('title') . '</strong><br />';
$content .= '<span>' . $post->getHtml('description') . '</span><br />';
$content .= '<a href="http://' . $this->cfg('SITE') . '/' . $post->get('type') . '/' . $id . '/">подробнее...</a>';
if ($post->exists('save_and_send')) {
$mail = new Mail();
$mail->setFromMail(array($this->cfg('SITE'), $this->cfg('mail')));
$key = 'http://' . $this->cfg('SITE') . '/cabinet/unsubscribe/?key=' . md5($this->getUser('mail') . $this->getType() . 'unsubscribe') . '&type=' . $this->getType() . '&mail=' . $this->getUser('mail');
$key = '<a href="' . $key . '">' . $key . '</a>';
$mail->setTemplate('letter_' . $this->getType(), array('FROM_SITE' => $this->cfg('SITE'), 'CONTENT' => $content, 'BODY' => $post->get('content'), 'TITLE' => $post->get('title')));
$mail->xsend($this->getUser('mail'), array('UNSUBSCRIBE' => $key));
} elseif ($post->exists('save_and_send_all')) {
$q = "SELECT distinct mail,id FROM sc_subscribe WHERE type LIKE '%" . $this->getType() . "%' \r\n\t\t\t\tAND NOT EXISTS(SELECT mailid FROM sc_news_sendlog WHERE id=mailid AND newsid={$id}){$this->getMailFilter()}";
if ($post->getInt('pack')) {
$q .= " LIMIT {$post->getInt('pack')}";
}
$rs = $ST->select($q);
$mail = new Mail();
// $mail->setFromMail($this->getConfig('mail'));
$mail->setFromMail(array($this->cfg('SITE'), $this->cfg('mail')));
$mail->setTemplate('letter_' . $this->getType(), array('FROM_SITE' => $this->cfg('SITE'), 'CONTENT' => $content, 'BODY' => $post->get('content'), 'TITLE' => $post->get('title')));
$n = 0;
while ($rs->next()) {
if (check_mail($m = trim($rs->get('mail')))) {
$key = 'http://' . $this->cfg('SITE') . '/cabinet/unsubscribe/?key=' . md5($rs->get('mail') . $this->getType() . 'unsubscribe') . '&type=' . $this->getType() . '&mail=' . $rs->get('mail');
$key = '<a href="' . $key . '">' . $key . '</a>';
$mail->xsend($m, array('UNSUBSCRIBE' => $key));
$ST->insert('sc_news_sendlog', array('mailid' => $rs->get('id'), 'newsid' => $id));
$n++;
} else {
$ST->delete('sc_subscribe', "mail='" . SQL::slashes($rs->get('mail')) . "'");
}
}
$msg .= " отправлено {$n}";
}
}
echo printJSONP(array('msg' => $msg, 'id' => $id, 'img' => $img_out));
exit;
}
示例6: foreach
<?php
echo $this->getText($this->type);
/*h1 class="header"><span><?=$this->getHeader()?></span></h1*/
if ($rs) {
?>
<div id="awards">
<?php
foreach ($rs as $row) {
?>
<?php
if (trim($row['img'])) {
?>
<img src="<?php
echo scaleImg($row['img'], 'w90h90');
?>
"><?php
}
?>
<div class="item">
<a class="header" href="<?php
echo $this->mod_uri;
?>
view/<?php
echo $row['id'];
?>
/"><?php
echo $row['title'];
?>
示例7: scaleImg
if ($n++ % 2) {
?>
even<?php
}
?>
">
<td>
<?php
$url = "http://" . $_SERVER['HTTP_HOST'] . "/catalog/goods/" . $goods['id'] . "/";
if (!empty($goods['proposalid'])) {
$url = "http://" . $_SERVER['HTTP_HOST'] . "/catalog/proposal/" . $goods['proposalid'] . "/";
}
$img = $goods['img'];
?>
<a class="img" style="background-image:url('<?php
echo scaleImg($img, 'w65h65');
?>
')" href="<?php
echo $url;
?>
" class="title" title=" <?php
echo htmlspecialchars($goods['description']);
?>
"></a>
</td>
<td>
<a title=" <?php
echo htmlspecialchars($goods['description']);
?>
" class="title" href="<?php
echo $url;
示例8: while
<table class="grid">
<tr><th><input type="checkbox" class="item" name="all"></th><th>Изображение</th><th>Название</th><th>Дата</th><th>Показов</th><th>Стадия</th><th>Действие</th></tr>
<?php
while ($this->rs->next()) {
?>
<tr>
<td><input type="checkbox" name="item[]" value="<?php
echo $this->rs->get('id');
?>
"></td>
<td style="width:110px">
<?php
if ($this->rs->get('img')) {
?>
<img src="<?php
echo scaleImg($this->rs->get('img'), 'w100');
?>
" alt="<?php
echo $this->rs->get('title');
?>
"/><?php
} else {
?>
<img src="/img/admin/no_image.png"/><?php
}
?>
</td>
<td style="text-align:left">
<a href="/admin/<?php
echo $this->rs->get('type');
示例9: foreach
if ($rs = $gallery_list) {
?>
<h2 id="gall">фотогалерея</h2>
<div class="gallery">
<?php
foreach ($rs as $item) {
?>
<div class="item ">
<a class="img" href="/gallery/<?php
echo $item['id'];
?>
/" title=" <?php
echo $item['name'];
?>
" style="background-image:url(<?php
echo scaleImg($item['img'], 'w300');
?>
)"></a>
<div class="name_desc">
<a class="name" title=" <?php
echo $item['name'];
?>
" href="/gallery/<?php
echo $item['id'];
?>
/"><?php
echo $item['name'];
?>
</a>
</div>
</div><?php
示例10: foreach
foreach ($vendorList as $item) {
?>
<div class="item">
<?php
$img = $item['avat'] ? $item['avat'] : $this->cfg('NO_IMG');
?>
<?php
$href = "/vendor/{$item['u_id']}/";
?>
<!--w300h200-->
<!--w300h200-->
<a class="img" href="<?php
echo $href;
?>
" style="background-image:url('<?php
echo scaleImg($img, list_val($item['img_format'], array('w300h200', 'sq300')));
?>
')"></a>
<a class="name" href="<?php
echo $href;
?>
"><?php
echo $item['company'];
?>
</a>
<small><a href="/catalog/vendor/<?php
echo $item['u_id'];
?>
示例11: foreach
<?php
if ($our_works = $this->getGallery('our_works')) {
?>
<h2>Новый объект</h2>
<div class="side-blk">
<?php
foreach ($our_works as $g) {
?>
<a href="/our_works/<?php
echo $g['id'];
?>
/">
<img src="<?php
echo scaleImg($g['img'], 'w180');
?>
">
<?php
echo $g['name'];
?>
</a>
<?php
echo $g['description'];
?>
<?php
}
?>
<a class="more" href="/our_works/">Готовые объекты »</a>
</div>
示例12: foreach
<?php
if (($rs = $imgList) && count($rs) > 1) {
?>
<div id="preview" class="">
<a href="javascript:previewScrool(-160);" class="left" ></a>
<a href="javascript:previewScrool(160);" class="right"></a>
<ul>
<?php
foreach ($rs as $n => $item) {
?>
<li>
<a href="<?php
echo scaleImg($item, 'w800');
?>
" rel='<?php
if ($n) {
?>
gallery<?php
}
?>
' rel2="<?php
echo Img::scaleBySize($item, $unit, array(620, 360));
//=scaleImg($item,'w400')
?>
" style="background-image:url(<?php
echo Img::scaleBySize($item, $unit, array(110, 80));
//=scaleImg($item,'h80')
?>
示例13: htmlspecialchars
?>
</div>
<?php
$img = $item['img'] ? $item['img'] : $this->cfg('NO_IMG');
?>
<a class="img " title=" <?php
echo htmlspecialchars($item['name']);
?>
" style="background-image:url('<?php
echo scaleImg($img, 'w280h140');
?>
')" href="<?php
echo $url;
?>
" rel="<?php
echo scaleImg($img, 'w420h420');
?>
"></a>
<a class="name" <?php
/*title=" <?=$item['name']?>"*/
?>
href="<?php
echo $url;
?>
"><?php
echo isset($_GET['search']) ? preg_replace('=' . preg_quote($_GET['search']) . '=i', '<span style="color:red">\\0</span>', $item['name']) : $item['name'];
?>
</a>
<span class="desc">
<?php
/*if($item['in_stock']==0){?>
示例14: scaleImg
"/>
<img id="img" src="<?php
echo $img ? scaleImg($img, 'w100h100') : '/img/admin/no_image.png';
?>
">
<input type="file" name="img_upload"><button type="button" name="clear">Удалить</button>
</td>
</tr>
<tr>
<th>Изображение авто</th>
<td><input type="hidden" name="img_car" value="<?php
echo $img_car;
?>
"/>
<img id="img_car" src="<?php
echo $img_car ? scaleImg($img_car, 'w100h100') : '/img/admin/no_image.png';
?>
">
<input type="file" name="img_car_upload"><button type="button" name="clear">Удалить</button>
</td>
</tr>
<tr>
<th>Статус</th>
<td>
<?php
foreach (array(0 => 'Неактивен', 1 => 'Активен') as $key => $desc) {
?>
<input type="radio" name="state" value="<?php
echo $key;
?>
示例15: scaleImg
<tr><th>Фио: </th><td><input class="input-text" name="name" value="<?php
echo $name;
?>
"/></td> </tr>
<tr><th>Организация: </th><td><input class="input-text" name="company" value="<?php
echo $company;
?>
"/></td> </tr>
<tr><th>Изображение: </th>
<td>
<img id="img-file" src="<?php
echo $avat ? scaleImg($avat, 'w200') : '/img/no_image.png';
?>
"/><br/>
<input type="file" name="upload"> <input type="checkbox" name="clear" value="1"><label>Удалить</label><br>
<select name="img_format">
<?php
foreach ($this->enum('img_format') as $k => $d) {
?>
<option value="<?php
echo $k;
?>
" <?php
if ($k == $img_format) {
?>
selected<?php
}