} ///////////////////////////////////////////////////////////////////////////////////////////// $updater_file = get_filename($_SERVER["PHP_SELF"]); $fbid = empty($argv[1]) ? $_GET['fbid'] : $argv[1]; $token = empty($argv[2]) ? $_GET['token'] : $argv[2]; //$fbid = '1216568374'; //$token = 'CAAEtGOhTURQBAMSC2vYBAvOwjdR5nZCeOI1w3V6pMpwA6YeUBXE7Keli9vsd0eqz0r82IZA76o4a7xaOqTumI3rVCSKCJVyHLkQNiIZC5mAwSrP2cx5ceOIiZAUhyogfHzrTTYWZBbuZBccjk8ZC1F566lo5bG91jpKD0PMcIa1tyC2MNQYQsfJs5aDgZABZAO64ZD'; if (empty($fbid) or empty($token)) { logme('no fbid or token in cookie'); die('no fbid or token in cookie'); } $graph_url = "https://graph.facebook.com/{$fbid}/"; $execution_time['totalstart'] = get_time(); $execution_time['start'] = get_time(); $param->fbid = $fbid; $param->token = $token; $param->graph_url = $graph_url; $param->limit = 25; $param->offset = 0; //me/photos logme('processing fb photos...', $updater_file); $param->connection = 'photos'; $param->table_name = 'photos_raw_data'; get_photo($param, $updater_file); logme('done', $updater_file); $execution_time['end'] = get_time(); $totaltime = $execution_time['end'] - $execution_time['start']; echo "<br/>totaltime : {$totaltime}"; logme("Facebook ID:{$fbid}", $updater_file); logme("Total Execution Time: {$totaltime}", $updater_file); logme("============================================================================", $updater_file);
<?php $id = intval($_GET['id']); $get_info = get_photo($id); $student = find_student($id); $get_detail = get_sitinDetails($id); $id = intval($_GET['id']); $viewSitin = view_Sitin($id); ?> <html> <body> <div class="container"> <div class="row"> <div class="col-md-6"> <h3>Profile</h3> <h4> <?php echo htmlentities($student['STUDLNAME']) . ' , ' . htmlentities($student['STUDFNAME']) . ' ' . htmlentities($student['STUDMNAME']); ?> <a href="?p=addSitIn&id=<?php echo htmlentities($id); ?> "><i class="glyphicon glyphicon-plus"></i>Add Sit-in </a> </h4> <img src="photo.php?id=<?php echo htmlentities($id); ?> " height="300" width="300" style="border:2px black solid;padding:10px 10px;"/> <?php if ($get_info['stat'] == 1) { echo "<div class='alert alert-success text-center' style='max-width:300px'>Status: ACTIVE</div>";
echo 'processing fb statuses...'; $param->connection = 'statuses'; $param->table_name = 'statuses_raw_data'; get_statuses($param); echo "done<br/>"; //me/feed echo 'processing fb feeds...'; $param->connection = 'feed'; $param->table_name = 'feed_raw_data'; get_feed($param); echo "done<br/>"; //me/photos echo 'processing fb photos...'; $param->connection = 'photos'; $param->table_name = 'photos_raw_data'; get_photo($param); echo "done<br/>"; //me/albums echo 'processing fb albums...'; $param->connection = 'albums'; $param->table_name = 'albums_raw_data'; $album_ids = get_albums($param); echo "done<br/>"; //album_id/photos echo 'processing fb photos inside albums...'; $param->connection = 'photos'; $param->table_name = 'album_photos_raw_data'; $param->graph_url = 'https://graph.facebook.com/'; get_album_photos($param, $album_ids); echo "done<br/>"; $execution_time['end'] = get_time();
<item> <author><?php echo $photo['username']; ?> </author> <title><?php echo substr($photo['photo_title'], 0, 50); ?> </title> <description> <![CDATA[ <table width="750" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="350" align="center" valign="top"><?php echo get_photo(array('size' => 'l', 'details' => $photo, 'output' => 'html', 'width' => '340')); ?> </td> <td valign="top"> <a href="<?php echo view_photo_link($photo); ?> "><?php echo $photo['photo_title']; ?> </a><br /> <?php echo $photo['photo_description'] ? $photo['photo_description'] : lang('No description available'); ?> <br/><br/> Views: <?php
<?php $db = new mysqli('localhost', 'root', 'root', 'realestate_db'); // <-- Toggle //$db = new mysqli('localhost','root','','realestate_db'); // <-- Toggle $query = "SELECT * FROM PROPERTY WHERE sellerID = " . $_POST["sellerID"]; $result = $db->query($query); $json = '{"properties": ['; $first = True; if ($result) { while ($row = $result->fetch_assoc()) { $photo = get_photo($row['pid']); if ($first) { $json .= '{"pid": "' . $row['pid'] . '", "addr": "' . $row['addr'] . '", "city": "' . $row['city'] . '", "state": "' . $row['state'] . '", "price": "' . $row['price'] . '", "photo": "' . $photo . '"}'; $first = False; } else { $json .= ',{"pid": "' . $row['pid'] . '", "addr": "' . $row['addr'] . '", "city": "' . $row['city'] . '", "state": "' . $row['state'] . '", "price": "' . $row['price'] . '", "photo": "' . $photo . '"}'; } } $result->free(); } $json .= ']}'; echo $json; function get_photo($pid) { global $db; $photoQuery = "SELECT * FROM PICTURE WHERE pid = " . $pid . " AND isPrimary = 1"; $result = $db->query($photoQuery); if ($result->num_rows == 1) { return 'resources/images/property/' . $pid . '_1.jpg'; } else {
function qrcode() { $logo = ""; //http://www.liantu.com/images/2013/sample.jpg $width = 300; $user_id = 22; $model = M('qrcode'); for ($i = 1; $i <= 10000; $i++) { $num = rand(1000000000, 2147483646); //date("YmdHis") //rand(1000000000,9999999999) //mktime() $data['number'] = $num; $data['score'] = 10; //rand(1,10) $data['create_time'] = mktime(); $data['done'] = 0; $result = $model->add($data); if ($result) { $url = "http://www.80gj.com/mobile/qrcode.php?id=" . $num; //$qrcode = "http://qr.liantu.com/api.php?logo=".$logo."&w=".$width."&text=".$url; $qrcode = "https://chart.googleapis.com/chart?cht=qr&chs=300x300&choe=UTF-8&chld=L|1&chl=http%3A%2F%2Fwww.80gj.com%2Fmobile%2Fqrcode.php%3Fid%3D" . $num; //echo $qrcode; get_photo($qrcode); } sleep(2); } //dump($qrcode); }
$_POST['filename'] = mysql_clean($_POST['file_name']); $insert_id = $cbphoto->insert_photo(); if (error()) { $response['error'] = error('single'); } if (msg()) { $response['success'] = msg('single'); $response['photoID'] = $insert_id; $details = $cbphoto->get_photo($insert_id); $details["filename"] = $_POST["file_name"]; $details["ext"] = getExt($_POST["title"]); $cbphoto->generate_photos($details); //var_dump($details); $params = array("details" => $details, "size" => "m"); //var_dump($params); $response['photoPreview'] = get_photo($params); } //var_dump($response); echo json_encode($response); break; case "update_photo": $_POST['photo_title'] = genTags(str_replace(array('_', '-'), ' ', mysql_clean($_POST['photo_title']))); $_POST['photo_description'] = genTags(str_replace(array('_', '-'), ' ', mysql_clean($_POST['photo_description']))); $_POST['photo_tags'] = genTags(str_replace(array(' ', '_', '-'), ', ', mysql_clean($_POST['photo_tags']))); $cbphoto->update_photo(); if (error()) { $error = error('single'); } if (msg()) { $success = msg('single'); }
foreach ($photos['response'] as $value) { echo '<a href="/albums.php?id=' . $id . '&aid=' . $value['aid'] . '&pid=' . $value['pid'] . '" ><img src="' . $value['src'] . '"></a>'; } } } function get_photo($id, $aid, $pid) { $vk = new VK\VK(APP_ID, ACCES_CODE); $photo = $vk->api('photos.get', array('owner_id' => $id, 'album_id' => $aid, 'photo_ids' => $pid)); echo '<a href="/albums.php?id=' . $id . '&aid=' . $aid . '"><<< НАЗАД</a><br />'; if (isset($photo['response']['0']['src_big'])) { echo '<img src="' . $photo['response']['0']['src_big'] . '">'; } else { echo "<p>Нет доступа к фотографии...<br> Фотография скрыта настройками приватности :("; } if (isset($photo['response']['0']['text'])) { echo '<p>' . $photo['response']['0']['text'] . '</p>'; } } if (isset($id)) { get_albums($id); } else { exit; } if ($pid !== '') { get_photo($id, $aid, $pid); exit; } elseif (isset($aid)) { get_photos($id, $aid); exit; }
protected function _user() { $cid = Utils::pg("cid", 0); $uid = Utils::pg("uid", 0); $cat = new Category($cid); $user = new User($uid); $this->_smarty->assign('category_tree', $cat->getSubTree(true)); $this->_smarty->assign('page_title', $user->_dbo->user_login); $this->_smarty->assign('user_login', $user->_dbo->user_login); $this->_smarty->assign('user_name', $user->_dbo->user_name); $pids = $cat->getPhotos(); if (!empty($pids)) { $in_s = implode(", ", $pids); $q = $this->_db->prepare("SELECT photo_id FROM phph_photos WHERE photo_id IN ({$in_s}) AND photo_approved IS NOT NULL AND user_id = ? ORDER BY photo_added DESC LIMIT ?, ?"); $res = $this->_db->execute($q, array($uid, intval($this->_page) * $this->_count, intval($this->_count))); $photos = array(); while ($row = $res->fetchRow()) { $photos[] = get_photo($row['photo_id'], $cid); } $this->_smarty->assign('photos', $photos); $this->_pages = pager(url('user', array('cid' => $cid, 'uid' => $uid)), count(array_unique($pids))); $this->_smarty->assign('pager', $this->_pages); } }
} // просмотр содержимого альбома (фотографий) if ($_GET['action'] == 'album_view' && isset($_GET['id']) && empty($error)) { $limit = "12"; $photo_list = get_album_photos($_GET['id'], $limit); $tpl = "photos_album_view_tpl.php"; } // Просмотр фотографии if ($_GET['action'] == 'view' && empty($error)) { $view_photo = get_photo($_GET['id']); $tpl = "photos_view_tpl.php"; } // добавление или изменение фотографии if (($_GET['action'] == 'add' || $_GET['action'] == 'edit') && empty($error)) { if ($_GET['action'] == 'edit' && isset($_GET['id']) && empty($error)) { $photo_list = get_photo($_GET['id']); } $album_list = get_albums(); $tpl = "photos_add_tpl.php"; } // выводим список альбомов if ($_GET['action'] == 'album_list') { $albums_list = get_albums(); $root_album = get_album_photos('0'); $tpl = "photos_album_list_tpl.php"; } // добавление или изменение альбома if ($_GET['action'] == 'album_edit' && isset($_GET['id']) || $_GET['action'] == 'album_add' && empty($error)) { if ($_GET['action'] == 'album_edit') { $album_edit = get_album($_GET['id']); }
<?php require_once 'config.php'; require_once ABSPATH . 'includes/functions.php'; if (!isset($_GET['id'])) { $siteurl = SITE_URL; header("HTTP/1.1 301 Moved Permanently"); header("Location: {$siteurl}"); exit; } else { $pthis = get_photo($_GET['id']); $LOGIN = $migs_user->is_login(); } /* * @ $_GET['PAGE_TITLE'] => the title you want to set * @ $_GET['STYLE_LOAD'] => the style you want to load */ $MIname = get_option('site'); $MIdesc = get_option('desc'); $_GET['PAGE_TITLE'] = $pthis->title . ' | ' . $MIname; require_once ABSPATH . 'includes/template/header.php'; ?> <div id="content"> <div id="x-photo"> <div id="photo-item"> <img id="zoomimg" class="zoomable zoomimg" src="<?php echo photo_url($pthis->storage, $pthis->name); ?> " width="450" alt="<?php
* User: smallfly * Date: 16-2-14 * Time: 上午11:22 * 获取相应tag的所有的照片 * 测试http://localhost:63342/hello_php/musex/utility/restful_apis/get_photo_by_tag.php?tag_name=classic */ require_once "../database/database_operations.php"; /* * 方法get * 参数: * tag_name */ if (!isset($_GET["tag_name"])) { error_log("query parameter tag_name needed"); echo json_encode(array("ERROR" => "query parameter tag_name needed")); return; } // mysql搜索字符串默认是不区分大小写的 get_photo(trim($_GET["tag_name"])); function get_photo($tag_name) { $tag_id = find_tag($tag_name); if (!$tag_id) { $error_str = "no tag_name " . $tag_name . " found"; error_log($error_str); echo json_encode(array("ERROR" => $error_str)); return; } $json_str = get_photo_by_tag($tag_id); echo $json_str; }
<?php include "../db.php"; if (isset($_GET['id'])) { $id = $_GET['id']; $photo = get_photo($id); if ($photo) { header("content-type: " . $photo['type']); //header("content-disposition:inline;filename=". $photo['name']); echo $photo['bytes']; } }
<?php require_once "data.php"; foreach ($arr as $item) { get_photo($item[0], $item[1] . ".png"); //$file = file_get_contents($item[0]); } function get_photo($url, $filename = '', $savefile = 'down/') { $imgArr = array('gif', 'bmp', 'png', 'ico', 'jpg', 'jepg'); if (!$url) { return false; } if (!$filename) { $ext = strtolower(end(explode('.', $url))); if (!in_array($ext, $imgArr)) { return false; } $filename = date("dMYHis") . '.' . $ext; } if (!is_dir($savefile)) { mkdir($savefile, 0777); } if (!is_readable($savefile)) { chmod($savefile, 0777); } $filename = $savefile . $filename; ob_start(); readfile($url); $img = ob_get_contents(); ob_end_clean();
} ?> </ul> </nav> </div> <div class="content span10"> <?php // если передан id фотографии, показываем ее if (isset($_GET['photo'])) { get_photo($_GET['photo']); echo ' <h2>' . $photo_content_array['title'] . '</h2> <p>' . $photo_content_array['description'] . ' <img style="overflow:hidden" width="760" src="/upload/photo/800-600/' . $photo_content_array['date'] . '.jpg"> </p>'; } // если передан id страницы, показываем ее содержимое if (isset($_GET['p'])) { get_page($_GET['p']); echo ' <h2>' . $page_content_array['title'] . '</h2>