diff --git a/classes/class_image_tools.php b/classes/class_image_tools.php index 95dc27c2..cbb908e7 100644 --- a/classes/class_image_tools.php +++ b/classes/class_image_tools.php @@ -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; } ?> diff --git a/sections/artist/artist.php b/sections/artist/artist.php index 3a1146ce..92c3d76a 100644 --- a/sections/artist/artist.php +++ b/sections/artist/artist.php @@ -520,7 +520,7 @@ function compare($X, $Y){
- <?=$Name?> + <?=$Name?>
diff --git a/sections/bookmarks/torrents.php b/sections/bookmarks/torrents.php index 177fc71d..57d21b08 100644 --- a/sections/bookmarks/torrents.php +++ b/sections/bookmarks/torrents.php @@ -285,7 +285,7 @@ function compare($X, $Y){ $Image = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?i='.urlencode($Image); } ?> - <?=$DisplayName?> + <?=$DisplayName?>
diff --git a/sections/collages/collage.php b/sections/collages/collage.php index 189476b7..e41e8c5f 100644 --- a/sections/collages/collage.php +++ b/sections/collages/collage.php @@ -324,7 +324,7 @@ function compare($X, $Y){ $Image = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?i='.urlencode($Image); } ?> - <?=$DisplayName?> + <?=$DisplayName?>
diff --git a/sections/requests/request.php b/sections/requests/request.php index 64b52000..c85d269f 100644 --- a/sections/requests/request.php +++ b/sections/requests/request.php @@ -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); } ?> -

<?=$FullName?>

+

<?=$FullName?>

<?=$CategoryName?>

diff --git a/sections/torrents/details.php b/sections/torrents/details.php index a41fa829..b99052c7 100644 --- a/sections/torrents/details.php +++ b/sections/torrents/details.php @@ -121,7 +121,7 @@ function compare($X, $Y){ $WikiImage = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?i='.urlencode($WikiImage); } ?> -

<?=$AltName?>

+

<?=$AltName?>

diff --git a/sections/user/user.php b/sections/user/user.php index 9917ce1c..79584aad 100644 --- a/sections/user/user.php +++ b/sections/user/user.php @@ -412,7 +412,7 @@ function check_paranoia_here($Setting) { if (check_perms('users_view_keys',$Class) || $OwnProfile) { ?> -
  • Passkey: [view]
  • +
  • Passkey: [View]
  • - <?=display_str($RS['Artist'])?><?=display_str($RS['Name'])?> + <?=display_str($RS['Artist'])?><?=display_str($RS['Name'])?> @@ -682,7 +682,7 @@ function check_paranoia_here($Setting) { - <?=$RU['Artist']?><?=$RU['Name']?> + <?=$RU['Artist']?><?=$RU['Name']?> @@ -726,7 +726,7 @@ function check_paranoia_here($Setting) { $Name .= $GroupName; ?> - <?=$Name?> + <?=$Name?>