本文整理汇总了PHP中getImageSrc函数的典型用法代码示例。如果您正苦于以下问题:PHP getImageSrc函数的具体用法?PHP getImageSrc怎么用?PHP getImageSrc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getImageSrc函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: addEventToZip
function addEventToZip($eid, $mid, $zip)
{
$query = "SELECT Id, MonitorId, StartTime, Frames FROM Events WHERE Id={$eid}";
$results = dbFetchAll($query);
$scale = max(reScale(SCALE_BASE, '100', ZM_WEB_DEFAULT_SCALE), SCALE_BASE);
foreach ($results as $result) {
for ($counter = 1; $counter <= $result['Frames']; $counter++) {
$event['Id'] = $result['Id'];
$event['StartTime'] = $result['StartTime'];
$event['MonitorId'] = $result['MonitorId'];
$imageData = getImageSrc($event, $counter, $scale, isset($_REQUEST['show']) && $_REQUEST['show'] == "capt");
$imagePath = $imageData['thumbPath'];
$eventPath = $imageData['eventPath'];
$dImagePath = sprintf("%s/%0" . ZM_EVENT_IMAGE_DIGITS . "d-diag-d.jpg", $eventPath, $counter);
$rImagePath = sprintf("%s/%0" . ZM_EVENT_IMAGE_DIGITS . "d-diag-r.jpg", $eventPath, $counter);
$frames[] = viewImagePath($imagePath);
}
$zip->addDirectory("events/" . $event['MonitorId']);
$zip->addDirectory("events/" . $event['MonitorId'] . "/" . $event['Id']);
}
$i = 0;
$filesString = "";
foreach ($frames as $frame) {
$i++;
$filesName = sprintf("%0" . ZM_EVENT_IMAGE_DIGITS . "d-capture.jpg", $i);
$filesString .= "\nframes.push(\"events/" . $mid . "/" . $eid . "/" . $filesName . "\");";
$zip->addLargeFile($frame, "events/" . $mid . "/" . $eid . "/" . $filesName);
}
return $filesString;
}
开发者ID:OverByThere,项目名称:modern,代码行数:30,代码来源:exportevents.php
示例2: getSearch
public function getSearch()
{
$categoryId = Input::get('categoryid');
$search = Input::get('query');
$objects = null;
if ($categoryId) {
// Category Image
if ($featuredImageId = ObjectMeta::getValue($categoryId, '_featured_image')) {
$featuredImageUrl = getImageSrc($featuredImageId, 'thumbnail');
}
// Get objects where in category
$objects = Object::Where('type', 'object_type')->whereExists(function ($query) use($categoryId) {
$query->select(DB::raw(1))->from('object_meta')->whereRaw(DB::getTablePrefix() . 'object_meta.object_id = ' . DB::getTablePrefix() . 'objects.id')->where('meta_key', '_category_id')->where('meta_value', $categoryId);
})->select(DB::raw('substr(name, 14) as field_name'))->get()->toArray();
$types = array_map(function ($v) {
return $v['field_name'];
}, $objects);
if (!empty($types)) {
$objects = Object::whereIn('type', $types);
}
}
if ($objects) {
$objects = $objects->select(array('objects.id', DB::raw('"/uploads/' . $featuredImageUrl . '"' . ' as featured_image'), 'objects.name', 'objects.title', 'objects.excerpt'))->get();
}
return $objects;
}
开发者ID:Avimunk,项目名称:jini_1,代码行数:26,代码来源:ObjectController.php
示例3: getCategories
public function getCategories($id = null)
{
//Config::set('laravel-debugbar::config.enabled', false);
$categories = Object::where('objects.type', 'category')->where('parent_id', $id)->select(array('objects.id', 'objects.title', 'objects.name'))->get();
$response = $categories;
foreach ($categories as $category) {
if ($contentImageId = ObjectMeta::getValue($category->id, '_content_image')) {
if ($contentImageUrl = getImageSrc($contentImageId, 'medium')) {
$category['contentImageUrl'] = '/uploads/' . $contentImageUrl;
}
}
if ($featuredImageId = ObjectMeta::getValue($category->id, '_featured_image')) {
if ($featuredImageUrl = getImageSrc($featuredImageId, 'thumbnail')) {
$category['featuredImageUrl'] = '/uploads/' . $featuredImageUrl;
}
}
$category['childrenCount'] = Object::where('objects.type', 'category')->where('parent_id', $category['id'])->count();
$category['itemsCount'] = ObjectMeta::join('objects', 'object_meta.object_id', '=', 'objects.id')->where('meta_key', '_category_id')->where('meta_value', $category['id'])->where('objects.type', '<>', 'category')->groupBy('object_id')->count();
}
// $categories = Object::leftJoin('objects as t1', function($join) {
// $join->on('objects.id', '=', 't1.parent_id');
// })
// ->where('objects.type', 'category')
// //->whereNull('objects.parent_id')
// ->where('t1.parent_id', $id)
// ->select(DB::raw('jini_t1.*'))
// ->get();
//print_r($categories);
//
// $response = array(
// 'categories' => $categories
// //'contentImage' =>
// );
return response()->json($categories);
}
开发者ID:Avimunk,项目名称:jini_1,代码行数:35,代码来源:CategoryController.php
示例4: default
public function default()
{
$default = "assets/images/default.jpg";
if (FileSystem::exists($default) && FileSystem::isImage($default)) {
return getImageSrc($default, $this->width, $this->height);
}
return null;
}
开发者ID:akitech,项目名称:hooks-src,代码行数:8,代码来源:Image.php
示例5: getEdit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function getEdit($id)
{
$object = Object::find($id);
$parent_id = $object->parent_id;
$categories = Object::where('type', 'category')->where('id', '!=', $id)->get();
if ($imageObjectId = $object->getValue('_featured_image')) {
$featuredImage = getImageSrc($imageObjectId, 'thumbnail');
}
if ($imageObjectId = $object->getValue('_content_image')) {
$contentImage = getImageSrc($imageObjectId, 'thumbnail');
}
$toolTip = $object->getValue('_tooltip');
return view('admin.category.create_edit', compact('object', 'parent_id', 'categories', 'featuredImage', 'contentImage', 'toolTip'));
}
开发者ID:arielcrm,项目名称:Jini,代码行数:20,代码来源:CategoryController.php
示例6: getEdit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function getEdit($id)
{
$object = Object::find($id);
$parent_id = $object->parent_id;
$categories = Object::where('type', 'category')->where('id', '!=', $id)->get();
if ($imageObjectId = $object->getValue('_featured_image')) {
// $featuredImage = getImageSrc($imageObjectId, 'thumbnail');
$featuredImage = 'cropped/' . getTheImageSize(getImageSrc($imageObjectId), '_featured_image');
}
if ($imageObjectId = $object->getValue('_content_image')) {
// $contentImage = getImageSrc($imageObjectId, 'thumbnail');
$contentImage = 'cropped/' . getTheImageSize(getImageSrc($imageObjectId), '_content_image');
}
$toolTip = $object->getValue('_tooltip');
$keywords = $object->keywords->implode('content', ', ');
return view('admin.category.create_edit', compact('object', 'parent_id', 'categories', 'featuredImage', 'contentImage', 'toolTip', 'keywords'));
}
开发者ID:Avimunk,项目名称:Jini-compie,代码行数:23,代码来源:CategoryController.php
示例7: processCategory
private function processCategory(&$category)
{
if ($contentImageId = ObjectMeta::getValue($category->id, '_content_image')) {
if ($contentImageUrl = getImageSrc($contentImageId, 'medium')) {
$category['contentImageUrl'] = '/uploads/' . $contentImageUrl;
}
}
if ($featuredImageId = ObjectMeta::getValue($category->id, '_featured_image')) {
if ($featuredImageUrl = getImageSrc($featuredImageId, 'small')) {
$category['featuredImageUrl'] = '/uploads/' . $featuredImageUrl;
// $path = __DIR__ . '/../../../public/uploads/' . $featuredImageUrl;
// echo $path . '<br />' . file_exists($path) . '<br />';
// if (file_exists($path)) {
// $type = pathinfo($path, PATHINFO_EXTENSION);
// $data = file_get_contents($path);
// $category['featuredImageUrl'] = base64_encode($data);
// }
}
}
$category['childrenCount'] = Object::where('objects.type', 'category')->where('parent_id', $category['id'])->count();
$category['itemsCount'] = ObjectMeta::join('objects', 'object_meta.object_id', '=', 'objects.id')->where('meta_key', '_category_id')->where('meta_value', $category['id'])->where('objects.type', '<>', 'category')->groupBy('object_id')->count();
return $category;
}
开发者ID:arielcrm,项目名称:Jini,代码行数:23,代码来源:CategoryController.php
示例8: dbFetchOne
}
} else {
$frame = dbFetchOne('SELECT * FROM Frames WHERE EventId = ? AND Score = ?', NULL, array($eid, $event['MaxScore']));
}
$maxFid = $event['Frames'];
$firstFid = 1;
$prevFid = $frame['FrameId'] - 1;
$nextFid = $frame['FrameId'] + 1;
$lastFid = $maxFid;
$alarmFrame = $frame['Type'] == 'Alarm';
if (isset($_REQUEST['scale'])) {
$scale = validInt($_REQUEST['scale']);
} else {
$scale = max(reScale(SCALE_BASE, $event['DefaultScale'], ZM_WEB_DEFAULT_SCALE), SCALE_BASE);
}
$imageData = getImageSrc($event, $frame, $scale, isset($_REQUEST['show']) && $_REQUEST['show'] == "capt");
$imagePath = $imageData['thumbPath'];
$eventPath = $imageData['eventPath'];
$dImagePath = sprintf("%s/%0" . ZM_EVENT_IMAGE_DIGITS . "d-diag-d.jpg", $eventPath, $frame['FrameId']);
$rImagePath = sprintf("%s/%0" . ZM_EVENT_IMAGE_DIGITS . "d-diag-r.jpg", $eventPath, $frame['FrameId']);
$focusWindow = true;
xhtmlHeaders(__FILE__, translate('Frame') . " - " . $event['Id'] . " - " . $frame['FrameId']);
?>
<body>
<div id="page">
<div id="header">
<div id="headerButtons">
<?php
if (ZM_RECORD_EVENT_STATS && $alarmFrame) {
echo makePopupLink('?view=stats&eid=' . $event['Id'] . '&fid=' . $frame['FrameId'], 'zmStats', 'stats', translate('Stats'));
}
开发者ID:rodoviario,项目名称:ZoneMinder,代码行数:31,代码来源:frame.php
示例9: getImage
function getImage($device)
{
global $config;
return '<img src="' . getImageSrc($device) . '" />';
}
开发者ID:samyscoub,项目名称:librenms,代码行数:5,代码来源:functions.php
示例10: sprintf
$map_init = "[" . $config['leaflet']['default_lat'] . ", " . $config['leaflet']['default_lng'] . "], " . sprintf("%01.0f", $config['leaflet']['default_zoom']);
$temp_output .= 'var map = L.map(\'leaflet-map\').setView(' . $map_init . ');
L.tileLayer(\'//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png\', {
attribution: \'© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors\'
}).addTo(map);
var markers = L.markerClusterGroup();
var redMarker = L.AwesomeMarkers.icon({
icon: \'server\',
markerColor: \'red\', prefix: \'fa\', iconColor: \'white\'
});
var greenMarker = L.AwesomeMarkers.icon({
icon: \'server\',
markerColor: \'green\', prefix: \'fa\', iconColor: \'white\'
});
';
foreach (dbFetchRows("SELECT `device_id`,`hostname`,`os`,`status`,`lat`,`lng` FROM `devices` LEFT JOIN `locations` ON `devices`.`location`=`locations`.`location` WHERE `disabled`=0 AND `ignore`=0 AND `lat` != '' AND `lng` != '' ORDER BY `status` ASC, `hostname`") as $map_devices) {
$icon = 'greenMarker';
if ($map_devices['status'] == 0) {
$icon = 'redMarker';
}
$temp_output .= "var title = '<a href=\"" . generate_device_url($map_devices) . "\"><img src=\"" . getImageSrc($map_devices) . "\" width=\"32\" height=\"32\" alt=\"\">" . $map_devices['hostname'] . "</a>';\n var marker = L.marker(new L.LatLng(" . $map_devices['lat'] . ", " . $map_devices['lng'] . "), {title: title, icon: {$icon}});\n marker.bindPopup(title);\n markers.addLayer(marker);\n";
}
$temp_output .= 'map.addLayer(markers);
</script>';
} else {
$temp_output = 'Mapael engine not supported here';
}
unset($common_output);
$common_output[] = $temp_output;
开发者ID:syzdek,项目名称:librenms,代码行数:31,代码来源:worldmap.inc.php
示例11: dbFetchOne
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
if (!canView('Events')) {
$_REQUEST['view'] = "error";
return;
}
$event = dbFetchOne('select E.*,M.Name as MonitorName from Events as E, Monitors as M where E.Id = ? and E.MonitorId = M.Id', NULL, array($_REQUEST['eid']));
$frame = dbFetchOne('select * from Frames where EventID = ? and Score = ?', NULL, array($_REQUEST['eid'], $event['MaxScore']));
$scale = getDeviceScale($event['Width'], $event['Height'], 2.2);
$image1 = getImageSrc($event, 1, $scale);
if ($frame['Type'] == 'Alarm') {
$image2 = getImageSrc($event, $frame['FrameId'], $scale);
} else {
$image2 = getImageSrc($event, intval($event['Frames'] / 2), $scale);
}
xhtmlHeaders(__FILE__, translate('Event') . ' - ' . $_REQUEST['eid']);
?>
<body>
<div id="page">
<div id="content">
<table id="contentTable" class="major">
<tr>
<th scope="row"><?php
echo translate('Name');
?>
</th>
<td><?php
echo htmlentities($event['Name']);
echo $event['Archived'] ? "(" . translate('Archived') . ")" : "";
开发者ID:rodoviario,项目名称:ZoneMinder,代码行数:31,代码来源:eventdetails.php
示例12: getFrameImage
function getFrameImage()
{
$eventId = $_REQUEST['id'][0];
$frameId = $_REQUEST['id'][1];
$sql = 'select * from Frames where EventId = ? and FrameId = ?';
if (!($frame = dbFetchOne($sql, NULL, array($eventId, $frameId)))) {
$frame = array();
$frame['EventId'] = $eventId;
$frame['FrameId'] = $frameId;
$frame['Type'] = "Virtual";
}
$event = dbFetchOne('select * from Events where Id = ?', NULL, array($frame['EventId']));
$frame['Image'] = getImageSrc($event, $frame, SCALE_BASE);
return $frame;
}
开发者ID:bill-mcgonigle,项目名称:ZoneMinder,代码行数:15,代码来源:status.php
示例13: getEdit
//.........这里部分代码省略.........
$field['label'] = 'Occupation';
$field['type'] = 'text';
$field['instructions'] = '';
$field['required'] = 0;
$values = $this->getFieldValues($id, $field);
$fieldControls[] = view('admin.partials.form.text', compact('field', 'values'));
// Address
$uniqueId = Hash::getUniqueId();
$field = array();
$field['id'] = '_field_address';
$field['name'] = 'address';
$field['label'] = 'Address';
$field['type'] = 'map';
$field['instructions'] = '';
$field['required'] = 0;
$values = $this->getFieldValues($id, $field);
$fieldControls[] = view('admin.partials.form.map', compact('field', 'values', 'uniqueId'));
// French
$field = array();
$field['id'] = '_field_french_speakers';
$field['name'] = 'french_speakers';
$field['label'] = 'French Speakers';
$field['type'] = 'boolean';
$field['instructions'] = '';
$field['required'] = 0;
$values = $this->getFieldValues($id, $field);
$fieldControls[] = view('admin.partials.form.boolean', compact('field', 'values'));
// Address
$field = array();
$field['id'] = '_field_phone';
$field['name'] = 'phone';
$field['label'] = 'Phone';
$field['type'] = 'tel';
$field['instructions'] = '';
$field['required'] = 0;
$values = $this->getFieldValues($id, $field);
$fieldControls[] = view('admin.partials.form.tel', compact('field', 'values'));
// Email
$field = array();
$field['id'] = '_field_email';
$field['name'] = 'email';
$field['label'] = 'Email';
$field['type'] = 'email';
$field['instructions'] = '';
$field['required'] = 0;
$values = $this->getFieldValues($id, $field);
$fieldControls[] = view('admin.partials.form.email', compact('field', 'values'));
foreach ($fieldsRows as $fieldRow) {
$field = unserialize($fieldRow['meta_value']);
$fields[] = $field;
//$field['value'] = $object->getValue($field['id']);
$values = array();
$valuesMeta = ObjectMeta::where('object_id', $id)->where('meta_key', 'LIKE', $field['id'] . '%')->get();
foreach ($valuesMeta as $valueMeta) {
$valueMetaKey = str_replace($field['id'], '', $valueMeta['meta_key']);
if (substr($valueMetaKey, 0, 1) == '-') {
$valueMetaKey = substr($valueMetaKey, 1);
}
$value = $valueMeta['meta_value'];
if ($value == '1') {
$value = 'on';
}
if ($valueMetaKey) {
$values[$valueMetaKey] = $value;
} else {
$values[] = $value;
}
}
$uniqueId = Hash::getUniqueId();
switch ($field['type']) {
case 'text':
$fieldControls[] = view('admin.partials.form.text', compact('field', 'values', 'uniqueId'));
break;
case 'wysiwyg':
$fieldControls[] = view('admin.partials.form.wysiwyg', compact('field', 'values', 'uniqueId'));
break;
case 'map':
$fieldControls[] = view('admin.partials.form.map', compact('field', 'values', 'uniqueId'));
break;
case 'tel':
$fieldControls[] = view('admin.partials.form.tel', compact('field', 'values', 'uniqueId'));
break;
case 'boolean':
$fieldControls[] = view('admin.partials.form.boolean', compact('field', 'values', 'uniqueId'));
break;
}
}
}
}
if (isset($object)) {
if ($imageObjectId = $object->getValue('_featured_image')) {
$featuredImage = getImageSrc($imageObjectId, 'thumbnail');
}
if ($imageObjectId = $object->getValue('_content_image')) {
$contentImage = getImageSrc($imageObjectId, 'thumbnail');
}
//d
}
return view('admin.object.create_edit', compact('object', 'fields', 'values', 'fieldControls', 'featuredImage', 'contentImage'));
}
开发者ID:arielcrm,项目名称:Jini,代码行数:101,代码来源:ObjectController.php
示例14: getImage
function getImage($device)
{
return '<img src="' . getImageSrc($device) . '" />';
}
开发者ID:gottaloveit,项目名称:librenms,代码行数:4,代码来源:functions.php
示例15: array
if ($result['disabled'] == 1) {
$highlight_colour = '#808080';
} else {
if ($result['ignored'] == 1 && $result['disabled'] == 0) {
$highlight_colour = '#000000';
} else {
if ($result['status'] == 0 && $result['ignore'] == 0 && $result['disabled'] == 0) {
$highlight_colour = '#ff0000';
} else {
if ($result['status'] == 1 && $result['ignore'] == 0 && $result['disabled'] == 0) {
$highlight_colour = '#008000';
}
}
}
}
$device[] = array('name' => $name, 'hostname' => $result['hostname'], 'device_id' => $result['device_id'], 'colours' => $highlight_colour, 'device_image' => getImageSrc($result), 'device_hardware' => $result['hardware'], 'device_os' => $config['os'][$result['os']]['text'], 'version' => $result['version'], 'location' => $result['location'], 'plugin' => $result['mplug_type']);
}
//end foreach
}
//end if
$json = json_encode($device);
die($json);
} else {
if ($_REQUEST['type'] == 'iftype') {
// Device search
if (is_admin() === true || is_read() === true) {
$results = dbFetchRows("SELECT `ports`.ifType FROM `ports` WHERE `ifType` LIKE '%" . $search . "%' GROUP BY ifType ORDER BY ifType LIMIT " . $limit);
} else {
$results = dbFetchRows("SELECT `I`.ifType FROM `ports` AS `I`, `devices` AS `D`, `devices_perms` AS `P`, `ports_perms` AS `PP` WHERE ((`P`.`user_id` = ? AND `P`.`device_id` = `D`.`device_id`) OR (`PP`.`user_id` = ? AND `PP`.`port_id` = `I`.`port_id` AND `I`.`device_id` = `D`.`device_id`)) AND `D`.`device_id` = `I`.`device_id` AND (`ifType` LIKE '%" . $search . "%') GROUP BY ifType ORDER BY ifType LIMIT " . $limit, array($_SESSION['user_id'], $_SESSION['user_id']));
}
if (count($results)) {
开发者ID:pblasquez,项目名称:librenms,代码行数:31,代码来源:ajax_search.php
示例16: Font
// APP ----------
// TODO: Auto colors
var font_white = new Font('<?php
echo getImageSrc('font_1.png');
?>
', 8, glyphsData);
var font_yellow = new Font('<?php
echo getImageSrc('font_1_yellow.png');
?>
', 8, glyphsData);
var font_black = new Font('<?php
echo getImageSrc('font_1_black.png');
?>
', 8, glyphsData);
var out = document.getElementById('out');
var canvas = document.getElementById('panel');
canvas.style.width = canvas.width * <?php
echo CANVAS_SCALE;
?>
+ 'px';
canvas.style.height = canvas.height * <?php
echo CANVAS_SCALE;
?>
+ 'px';
var ctx = canvas.getContext('2d');
开发者ID:episode17,项目名称:cobbler-web,代码行数:28,代码来源:index.php
示例17: createListThumbnail
function createListThumbnail( $event, $overwrite=false )
{
$sql = "select * from Frames where EventId = '".$event['Id']."' and Score = '".$event['MaxScore']."' order by FrameId limit 1";
if ( !($frame = dbFetchOne( $sql )) )
return( false );
$frameId = $frame['FrameId'];
if ( ZM_WEB_LIST_THUMB_WIDTH )
{
$thumbWidth = ZM_WEB_LIST_THUMB_WIDTH;
$scale = (SCALE_BASE*ZM_WEB_LIST_THUMB_WIDTH)/$event['Width'];
$thumbHeight = reScale( $event['Height'], $scale );
}
elseif ( ZM_WEB_LIST_THUMB_HEIGHT )
{
$thumbHeight = ZM_WEB_LIST_THUMB_HEIGHT;
$scale = (SCALE_BASE*ZM_WEB_LIST_THUMB_HEIGHT)/$event['Height'];
$thumbWidth = reScale( $event['Width'], $scale );
}
else
{
Fatal( "No thumbnail width or height specified, please check in Options->Web" );
}
$imageData = getImageSrc( $event, $frame, $scale, false, $overwrite );
$thumbData = $frame;
$thumbData['Path'] = $imageData['thumbPath'];
$thumbData['Width'] = (int)$thumbWidth;
$thumbData['Height'] = (int)$thumbHeight;
return( $thumbData );
}
开发者ID:ardiqghenatya,项目名称:koptel2,代码行数:33,代码来源:functions.php
示例18: elseif
$name = $result['hostname'];
if ($result['disabled'] == 1) {
$highlight_colour = '#808080';
} elseif ($result['ignored'] == 1 && $result['disabled'] == 0) {
$highlight_colour = '#000000';
} elseif ($result['status'] == 0 && $result['ignore'] == 0 && $result['disabled'] == 0) {
$highlight_colour = '#ff0000';
} elseif ($result['status'] == 1 && $result['ignore'] == 0 && $result['disabled'] == 0) {
$highlight_colour = '#008000';
}
if (is_admin() === TRUE || is_read() === TRUE) {
$num_ports = dbFetchCell("SELECT COUNT(*) FROM `ports` WHERE device_id = ?", array($result['device_id']));
} else {
$num_ports = dbFetchCell("SELECT COUNT(*) FROM `ports` AS `I`, `devices` AS `D`, `devices_perms` AS `P` WHERE `P`.`user_id` = ? AND `P`.`device_id` = `D`.`device_id` AND `I`.`device_id` = `D`.`device_id` AND device_id = ?", array($_SESSION['user_id'], $result['device_id']));
}
$device[] = array('name' => $name, 'device_id' => $result['device_id'], 'url' => generate_device_url($result), 'colours' => $highlight_colour, 'device_ports' => $num_ports, 'device_image' => getImageSrc($result), 'device_hardware' => $result['hardware'], 'device_os' => $config['os'][$result['os']]['text'], 'version' => $result['version'], 'location' => $result['location']);
}
}
$json = json_encode($device);
print_r($json);
exit;
} elseif ($_REQUEST['type'] == 'ports') {
// Search ports
if (is_admin() === TRUE || is_read() === TRUE) {
$results = dbFetchRows("SELECT `ports`.*,`devices`.* FROM `ports` LEFT JOIN `devices` ON `ports`.`device_id` = `devices`.`device_id` WHERE `ifAlias` LIKE '%" . $search . "%' OR `ifDescr` LIKE '%" . $search . "%' ORDER BY ifDescr LIMIT 8");
} else {
$results = dbFetchRows("SELECT DISTINCT(`I`.`port_id`), `I`.*, `D`.`hostname` FROM `ports` AS `I`, `devices` AS `D`, `devices_perms` AS `P`, `ports_perms` AS `PP` WHERE ((`P`.`user_id` = ? AND `P`.`device_id` = `D`.`device_id`) OR (`PP`.`user_id` = ? AND `PP`.`port_id` = `I`.`port_id` AND `I`.`device_id` = `D`.`device_id`)) AND `D`.`device_id` = `I`.`device_id` AND (`ifAlias` LIKE '%" . $search . "%' OR `ifDescr` LIKE '%" . $search . "%') ORDER BY ifDescr LIMIT 8", array($_SESSION['user_id'], $_SESSION['user_id']));
}
if (count($results)) {
$found = 1;
foreach ($results as $result) {
开发者ID:REAP720801,项目名称:librenms,代码行数:31,代码来源:ajax_search.php
示例19: getFrameImage
function getFrameImage()
{
$eventId = dbEscape($_REQUEST['id'][0]);
$frameId = dbEscape($_REQUEST['id'][1]);
$sql = "select * from Frames where EventId = '" . $eventId . "' and FrameId = '" . $frameId . "'";
if (!($frame = dbFetchOne($sql))) {
$frame = array();
$frame['EventId'] = $eventId;
$frame['FrameId'] = $frameId;
$frame['Type'] = "Virtual";
}
$event = dbFetchOne("select * from Events where Id = '" . $frame['EventId'] . "'");
$frame['Image'] = getImageSrc($event, $frame, SCALE_BASE);
return $frame;
}
开发者ID:ardiqghenatya,项目名称:koptel2,代码行数:15,代码来源:status.php
示例20: getLocations
public function getLocations()
{
$results = $this->getSearchPage(true);
$results = $results['items'];
// dd($results->toArray());
$data = array();
$locations = array('type' => 1, 'userMsg' => false);
if (!empty($results)) {
foreach ($results as $result) {
if ($lat = ObjectMeta::getValue($result->id, '_field_address-location-g')) {
if ($long = ObjectMeta::getValue($result->id, '_field_address-location-k')) {
$location = array('id' => $result->id, 'geo_latitude' => $lat, 'geo_longitude' => $long, 'location' => '', 'title' => $result->title, 'name' => $result->name, 'excerpt' => $result->excerpt, 'score' => $result->score);
if ($contentImageId = ObjectMeta::getValue($result->id, '_content_image')) {
$location['content_image'] = Url('/uploads/' . getImageSrc($contentImageId, 'medium'));
} else {
$location['content_image'] = '';
}
$location['address_street'] = ObjectMeta::getValue($result->id, '_field_address-address');
$location['address_city'] = ObjectMeta::getValue($result->id, '_field_address-city');
$location['address_country'] = ObjectMeta::getValue($result->id, '_field_address-country');
$location['promoted'] = ObjectMeta::getValue($result->id, '_field_promoted');
$data[] = $location;
}
}
}
}
$options = array();
foreach ($data as &$item) {
if (isset($options[$item['geo_latitude'] . '_' . $item['geo_longitude']])) {
$options[$item['geo_latitude'] . '_' . $item['geo_longitude']] += 1;
$current = $options[$item['geo_latitude'] . '_' . $item['geo_longitude']] - 1;
$lat = substr($item['geo_latitude'], -3);
if ($lat + $current * 10 < 1000) {
$lat = $lat + $current * 10;
$subLat = substr($item['geo_latitude'], 0, strlen($item['geo_latitude']) - 3);
$item['geo_latitude'] = $subLat . $lat;
} else {
$lat = substr($item['geo_latitude'], -4);
$lat = $lat + $current * 10;
$subLat = substr($item['geo_latitude'], 0, strlen($item['geo_latitude']) - 4);
$item['geo_latitude'] = $subLat . $lat;
}
} else {
$options[$item['geo_latitude'] . '_' . $item['geo_longitude']] = 1;
}
}
$locations['data'] = $data;
return $locations;
//return view('partials.map', compact( 'locations' ));
}
开发者ID:Avimunk,项目名称:Jini-compie,代码行数:50,代码来源:ObjectController.php
注:本文中的getImageSrc函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论