本文整理汇总了PHP中misc::getThumb方法的典型用法代码示例。如果您正苦于以下问题:PHP misc::getThumb方法的具体用法?PHP misc::getThumb怎么用?PHP misc::getThumb使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类misc
的用法示例。
在下文中一共展示了misc::getThumb方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: die
$script = '<script type="text/javascript">';
$tcount = 0;
$result = $db->query($query) or die($db->error);
//Limit main tag listing to $tags_limit tags. Keep the loop down to the minimum really.
while ($row = $result->fetch_assoc()) {
$tags = mb_trim($row['tags']);
if ($tcount <= $tags_limit) {
$ttags = explode(" ", $tags);
foreach ($ttags as $current) {
if ($current != "" && $current != " " && empty($gtags[$current])) {
$gtags[$current] = $current;
++$tcount;
}
}
}
$images .= '<span class="thumb"><a id="p' . $row['id'] . '" href="index.php?page=post&s=view&id=' . $row['id'] . '"><img src="' . $thumbnail_url . $misc->getThumb($row['image'], $row['directory']) . '" alt="post" border="0" title="' . $row['tags'] . ' score:' . $row['score'] . ' rating:' . $row['rating'] . '"/></a></span>';
$script .= 'posts[' . $row['id'] . '] = {\'tags\':\'' . strtolower(str_replace('\\', "\", str_replace("'", "'", $tags))) . '\'.split(/ /g), \'rating\':\'' . $row['rating'] . '\', \'score\':' . $row['score'] . ', \'user\':\'' . str_replace('\\', "\", str_replace(' ', '%20', str_replace("'", "'", $row['owner']))) . '\'};
';
}
$result->free_result();
if (isset($_GET['tags']) && $_GET['tags'] != "" && $_GET['tags'] != "all") {
$ttags = $db->real_escape_string(str_replace("'", "'", $_GET['tags']));
} else {
$ttags = "";
}
asort($gtags);
/*Tags have been sorted in ascending order
Let's now grab the index count from database
Needs to be escaped before query is sent!
URL Decode and entity decode for the links
*/
示例2: die
<?php
$query = "SELECT favorite FROM {$favorites_table} WHERE user_id='{$id}' ORDER BY added DESC LIMIT 5";
$result = $db->query($query) or die($db->error);
while ($row = $result->fetch_assoc()) {
$query = "SELECT id, directory as dir, image, tags, owner, rating, score FROM {$post_table} WHERE id='" . $row['favorite'] . "'";
$res = $db->query($query) or die($db->error);
$r = $res->fetch_assoc();
?>
<span class="thumb" id="p<?php
print $r['id'];
?>
"><a href="index.php?page=post&s=view&id=<?php
print $r['id'];
?>
"><img src="<?php
print $thumbnail_url . $misc->getThumb($r['image'], $r['dir']);
?>
" alt="<?php
print $r['tags'] . ' rating:' . $r['rating'] . ' score:' . $r['score'] . ' user:' . $r['owner'];
?>
" class="preview" title="<?php
print $r['tags'] . ' rating:' . $r['rating'] . ' score:' . $r['score'] . ' user:' . $r['owner'];
?>
"></a></span>
<script type="text/javascript">
posts['<?php
print $r['id'];
?>
'] = {'tags':'<?php
print mb_strtolower(str_replace('\\', "\", str_replace("'", "'", substr($r['tags'], 1, strlen($r['tags']) - 2))), 'UTF-8');
?>
示例3: misc
<?php
require "inv.header.php";
$id = $db->real_escape_string(basename($_SERVER["PATH_INFO"]));
if (!is_numeric($id)) {
die;
}
$misc = new misc();
$query = "SELECT image, directory, ext FROM {$post_table} WHERE id='{$id}' LIMIT 1";
$result = $db->query($query);
$row = $result->fetch_assoc();
$f = fopen("./thumbnails" . $misc->getThumb($row['image'], $row['dir']), "rb") or die;
$data = '';
header("Cache-Control: store, cache");
header("Pragma: cache");
header("Content-type: image/" . str_replace(".", "", $row['ext']));
while (!feof($f)) {
$data .= fread($f, 8192);
}
fclose($f);
print $data;
flush();
示例4: die
$query = "SELECT fcount FROM {$favorites_count_table} WHERE user_id='{$id}'";
$result = $db->query($query);
$row = $result->fetch_assoc();
$numrows = $row['fcount'];
$result->free_result();
if ($numrows < 1) {
die("<h1>You have no favorites.</h1>");
}
$images = '';
$query = "SELECT t2.id, t2.image, t2.directory as dir, t2.tags, t2.owner, t2.score, t2.rating FROM {$favorites_table} as t1 JOIN {$post_table} AS t2 ON t2.id=t1.favorite WHERE t1.user_id='{$id}' LIMIT {$page}, {$limit}";
$result = $db->query($query);
while ($row = $result->fetch_assoc()) {
$tags = $row['tags'];
$tags = substr($tags, 1, strlen($tags));
$tags = substr($tags, 0, strlen($tags) - 1);
$images .= '<span class="thumb" style="margin: 10px;"><a href="index.php?page=post&s=view&id=' . $row['id'] . '" id="p' . $row['id'] . '" onclick="document.location=\'index.php?page=post&s=view&id=' . $row['id'] . '\'; return false;"><img src="' . $thumbnail_url . $misc->getThumb($row['image'], $row['directory']) . '" title="' . $tags . '" border="0" alt="image_thumb"/></a>';
isset($_COOKIE['user_id']) && $_COOKIE['user_id'] == $id ? $images .= '<br /><a href="#" onclick="document.location=\'index.php?page=favorites&s=delete&id=' . $row['id'] . '&pid=' . $page . '\'; return false;"><b>Remove</b></a></span>' : ($images .= '</span>');
$images .= '<script type="text/javascript">
posts[' . $row['id'] . '] = {\'tags\':\'' . str_replace('\\', "\", str_replace(' ', '%20', str_replace("'", "'", $tags))) . '\'.split(/ /g), \'rating\':\'' . $row['rating'] . '\', \'score\':' . $row['score'] . ', \'user\':\'' . str_replace('\\', "\", str_replace(' ', '%20', str_replace("'", "'", $row['owner']))) . '\'}
</script>';
}
$images .= '<div style="margin-top: 550px; text-align: right;"><a id="pi" href="#" onclick="showHideIgnored(\'0\',\'pi\'); return false;"></a></div>
<script type="text/javascript">
filterPosts(posts)
</script>
<div id=\'paginator\'>';
echo $images;
ob_flush();
flush();
$result->free_result();
print $misc->pagination($_GET['page'], $_GET['s'], $id, $limit, $page_limit, $numrows, $page);
示例5: explode
++$ttcount;
}
}
$images .= '</ul></div></div>';
}
$images .= '<div class="post" id="p' . $row['post_id'] . '">';
$pat = $row['creation_date'];
$rating = $row['rating'];
$user = $row['owner'];
$tags = mb_trim($row['tags']);
$script .= 'posts.tags[' . $row['post_id'] . '] = \'' . str_replace('\\', "\", str_replace("'", "'", $tags)) . '\';' . 'posts.rating[' . $row['post_id'] . '] = \'' . $row['rating'] . '\';' . 'posts.score[' . $row['post_id'] . '] = \'' . $row['p_score'] . '\';';
if ($img != "") {
$script .= 'posts.totalcount[' . $lastpid . '] = \'' . $ptcount . '\';';
}
$ptcount = 0;
$images .= '<div class="col1"><a href="index.php?page=post&s=view&id=' . $row['post_id'] . '"><img src="' . $thumbnail_url . $misc->getThumb($row['image'], $row['dir']) . '" border="0" class="preview" title="' . $tags . '" alt="thumbnail"/></a></div><div class="col2">';
$img = $row['image'];
}
$images .= '<div class="comment" id="c' . $row['id'] . '"><h4><a href="index.php?page=account_profile&uname=' . $row['user'] . '">' . $row['user'] . '</a></h4><h6 class="comment-header">Posted on ' . $posted_at . ' (';
$row['spam'] == false ? $images .= '<a id="rc' . $row['id'] . '"></a><a href="#" id="rcl' . $row['id'] . '" onclick="Javascript:spam(\'comment\',\'' . $row['id'] . '\')">Flag for deletion</a>)</h6>' : ($images .= "<b>Already flagged</b>)</h6>");
$images .= "<div id=\"cbody" . $row['id'] . "\"><p>" . $misc->swap_bbs_tags($misc->short_url($misc->linebreaks($row['comment']))) . "</p></div></div>";
$script .= "posts.comments[" . $row['id'] . "] = {'score':" . $row['score'] . ", 'user':'" . str_replace('\\', "\", str_replace(' ', '%20', str_replace("'", "'", $row['user']))) . "', 'post_id':'" . $row['post_id'] . "'};";
++$ccount;
++$ptcount;
++$tcount;
$lastpid = $row['post_id'];
}
$ttags = explode(" ", $tags);
$images .= '</div><div class="col3"><ul class="post-info">';
$images .= "<li>{$pat}</li><li>rating:{$rating}</li><li>user:" . htmlentities($user, ENT_QUOTES, 'UTF-8') . "</li>";
$ttcount = 0;
示例6: explode
{
$ext = explode('.', $img);
$ext = array_pop($ext);
switch ($ext) {
case 'jpg':
case 'jpeg':
case 'webm':
case 'png':
case 'gif':
return true;
default:
return false;
}
}
$dir_contents = scandir($dir);
foreach ($dir_contents as $current) {
if (!is_dir($dir . $current) || $current == '.' || $current == '..') {
continue;
}
$dir_contents = scandir("./images/" . $current . "/");
if (!is_dir("./thumbnails/" . $current . "/")) {
$image->makethumbnailfolder($current);
}
foreach ($dir_contents as $item) {
$thumb = "./thumbnails" . $misc->getThumb($item, $current);
if ($item != '.' && $item != '..' && !is_dir($dir . $item) && is_valid_extension($item) && !file_exists($thumb)) {
$image->thumbnail($current . "/" . $item);
print $thumb . "<br>";
}
}
}