Empty commit

This commit is contained in:
Git 2012-06-22 08:00:10 +00:00
parent 78837ab056
commit c4345798c8
7 changed files with 57 additions and 42 deletions

View File

@ -4,35 +4,40 @@
*
**/
function to_thumbnail($url) {
$thumb = $url;
$extension = pathinfo($url, PATHINFO_EXTENSION);
if(contains('whatimg', $url)) {
if($extension == 'jpeg' || $extension == 'jpg') {
$thumb = replace_extension($url, '_thumb.jpg');
}
if($extension == 'png') {
$thumb = replace_extension($url, '_thumb.png');
}
if($extension == 'gif') {
$thumb = replace_extension($url, '_thumb.gif');
}
}
elseif(contains('imgur', $url)) {
if($extension == 'jpeg') {
$thumb = replace_extension($url, 'm.jpeg');
}
if($extension == 'jpg') {
$thumb = replace_extension($url, 'm.jpg');
}
if($extension == 'png') {
$thumb = replace_extension($url, 'm.png');
}
if($extension == 'gif') {
$thumb = replace_extension($url, 'm.gif');
}
}
if(contains('whatimg', $url)) {
if(hasWhatImgThumb($url)) {
if($extension == 'jpeg') {
$thumb = replace_extension($url, '_thumb.jpeg');
}
if($extension == 'jpg') {
$thumb = replace_extension($url, '_thumb.jpg');
}
if($extension == 'png') {
$thumb = replace_extension($url, '_thumb.png');
}
if($extension == 'gif') {
$thumb = replace_extension($url, '_thumb.gif');
}
}
}
elseif(contains('imgur', $url)) {
$url = cleanImgurUrl($url);
if($extension == 'jpeg') {
$thumb = replace_extension($url, 'm.jpeg');
}
if($extension == 'jpg') {
$thumb = replace_extension($url, 'm.jpg');
}
if($extension == 'png') {
$thumb = replace_extension($url, 'm.png');
}
if($extension == 'gif') {
$thumb = replace_extension($url, 'm.gif');
}
}
return $thumb;
}
@ -44,13 +49,21 @@ function replace_extension($string, $extension) {
}
function contains($substring, $string) {
$pos = strpos($string, $substring);
if($pos === false) {
return false;
}
else {
return true;
}
return $pos = strpos($string, $substring);
}
function hasWhatImgThumb($url) {
return !contains("_thumb", $url);
}
function cleanImgurUrl($url) {
$extension = pathinfo($url, PATHINFO_EXTENSION);
$path = preg_replace('/\.[^.]*$/', '', $url);
$last = $path[strlen($path)-1];
if($last == 'm' || $last == 'l' || $last == 's' || $last == 'h' || $last == 'b') {
$path = substr($path, 0, -1);
}
return $path . "." . $extension;
}
?>

View File

@ -520,7 +520,7 @@ function compare($X, $Y){
<div class="box">
<div class="head"><strong><?=$Name?></strong></div>
<div style="text-align:center;padding:10px 0px;">
<img style="max-width: 220px;" src="<?=$Image?>" alt="<?=$Name?>" onclick="lightbox.init(this,220);" />
<img style="max-width: 220px;" src="<?=to_thumbnail($Image)?>" alt="<?=$Name?>" onclick="lightbox.init('<?=$Image?>',220);" />
</div>
</div>
<? } ?>

View File

@ -285,7 +285,7 @@ function compare($X, $Y){
$Image = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?i='.urlencode($Image);
}
?>
<img src="<?=$Image?>" alt="<?=$DisplayName?>" title="<?=$DisplayName?>" width="117" />
<img src="<?=to_thumbnail($Image)?>" alt="<?=$DisplayName?>" title="<?=$DisplayName?>" width="117" />
<? } else { ?>
<div style="width:107px;padding:5px"><?=$DisplayName?></div>
<? } ?>

View File

@ -324,7 +324,7 @@ function compare($X, $Y){
$Image = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?i='.urlencode($Image);
}
?>
<img src="<?=$Image?>" alt="<?=$DisplayName?>" title="<?=$DisplayName?>" width="118" />
<img src="<?=to_thumbnail($Image)?>" alt="<?=$DisplayName?>" title="<?=$DisplayName?>" width="118" />
<? } else { ?>
<div style="width:107px;padding:5px"><?=$DisplayName?></div>
<? } ?>

View File

@ -6,6 +6,8 @@
include(SERVER_ROOT.'/sections/bookmarks/functions.php'); // has_bookmarked()
include(SERVER_ROOT.'/classes/class_text.php');
include(SERVER_ROOT.'/classes/class_image_tools.php');
$Text = new TEXT;
if(empty($_GET['id']) || !is_number($_GET['id'])) {
@ -115,7 +117,7 @@
$Image = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?i='.urlencode($Image);
}
?>
<p align="center"><img style="max-width: 220px;" src="<?=$Image?>" alt="<?=$FullName?>" onclick="lightbox.init(this,220);" /></p>
<p align="center"><img style="max-width: 220px;" src="<?=to_thumbnail($Image)?>" alt="<?=$FullName?>" onclick="lightbox.init('<?=$Image?>',220);" /></p>
<? } else { ?>
<p align="center"><img src="<?=STATIC_SERVER?>common/noartwork/<?=$CategoryIcons[$CategoryID-1]?>" alt="<?=$CategoryName?>" title="<?=$CategoryName?>" width="220" height="220" border="0" /></p>
<? } ?>

View File

@ -121,7 +121,7 @@ function compare($X, $Y){
$WikiImage = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?i='.urlencode($WikiImage);
}
?>
<p align="center"><img style="max-width: 220px;" src="<?=$WikiImage?>" alt="<?=$AltName?>" onclick="lightbox.init(this,220);" /></p>
<p align="center"><img style="max-width: 220px;" src="<?=to_thumbnail($WikiImage)?>" alt="<?=$AltName?>" onclick="lightbox.init('<?=$WikiImage?>',220);" /></p>
<?
} else {
?>

View File

@ -412,7 +412,7 @@ function check_paranoia_here($Setting) {
if (check_perms('users_view_keys',$Class) || $OwnProfile) {
?>
<li>Passkey: <a href="#" onclick="this.innerHTML='<?=display_str($torrent_pass)?>'; return false;">[view]</a></li>
<li>Passkey: <a href="#" onclick="this.innerHTML='<?=display_str($torrent_pass)?>'; return false;">[View]</a></li>
<? }
if (check_perms('users_view_invites')) {
if (!$InviterID) {
@ -643,7 +643,7 @@ function check_paranoia_here($Setting) {
<?
foreach($RecentSnatches as $RS) { ?>
<td>
<a href="torrents.php?id=<?=$RS['ID']?>" title="<?=display_str($RS['Artist'])?><?=display_str($RS['Name'])?>"><img src="<?=$RS['WikiImage']?>" alt="<?=display_str($RS['Artist'])?><?=display_str($RS['Name'])?>" width="107" /></a>
<a href="torrents.php?id=<?=$RS['ID']?>" title="<?=display_str($RS['Artist'])?><?=display_str($RS['Name'])?>"><img src="<?=to_thumbnail($RS['WikiImage'])?>" alt="<?=display_str($RS['Artist'])?><?=display_str($RS['Name'])?>" width="107" /></a>
</td>
<? } ?>
</tr>
@ -682,7 +682,7 @@ function check_paranoia_here($Setting) {
<tr>
<? foreach($RecentUploads as $RU) { ?>
<td>
<a href="torrents.php?id=<?=$RU['ID']?>" title="<?=$RU['Artist']?><?=$RU['Name']?>"><img src="<?=$RU['WikiImage']?>" alt="<?=$RU['Artist']?><?=$RU['Name']?>" width="107" /></a>
<a href="torrents.php?id=<?=$RU['ID']?>" title="<?=$RU['Artist']?><?=$RU['Name']?>"><img src="<?=to_thumbnail($RU['WikiImage'])?>" alt="<?=$RU['Artist']?><?=$RU['Name']?>" width="107" /></a>
</td>
<? } ?>
</tr>
@ -726,7 +726,7 @@ function check_paranoia_here($Setting) {
$Name .= $GroupName;
?>
<td>
<a href="torrents.php?id=<?=$GroupID?>" title="<?=$Name?>"><img src="<?=$C['WikiImage']?>" alt="<?=$Name?>" width="107" /></a>
<a href="torrents.php?id=<?=$GroupID?>" title="<?=$Name?>"><img src="<?=to_thumbnail($C['WikiImage'])?>" alt="<?=$Name?>" width="107" /></a>
</td>
<? } ?>
</tr>