Bravo List
Register
Go Back   > Bravo List > Source Code > Trackers > TBDev
Reply
  #11  
Old 20-12-18, 14:04
darkalchemy's Avatar
darkalchemy darkalchemy is offline
VIP
 
Join Date: Dec 2017
United States
Posts: 80
Default
Quote:
Originally Posted by Tedmorris View Post
It echos https
That's what you are checking, https or http.

Bump: Lets backup a bit, my initial response was mostly correct, with one exception.

You do not check the $_SERVER['REQUEST_SCHEME'] of the image, that is for the request.

Here is a simple example, I have not tested it, but should work. You would add this after all images have been processed in format_comment().

Code:
if (empty($_SERVER['REQUEST_SCHEME']) || $_SERVER['REQUEST_SCHEME'] === 'https') {
    preg_match_all('/<img.*?src=["|\']http:.*?["|\'].*?>/s', $s, $matches);
    foreach ($matches[0] as $match) {
        preg_match('/<img(.*?)src=["|\'](http:.*?)["|\'](.*?)>/s', $match, $links);
        $dummy_image = "
        <a href='{$links[2]}'>
            <img{$links[1]}alt='Dummy Image' src='dummy.image.png'{$links[3]}>
        </a>";
        $s = str_replace($match, $dummy_image, $s);
    }
}
Sorry, for the confusion.
__________________
I do custom coding, source installs, mods, server setup and/or config, etc. Feel free to pitch me your needs and your offer.

Last edited by darkalchemy; 20-12-18 at 17:59.
Reply With Quote
  #12  
Old 27-12-18, 15:03
Tedmorris's Avatar
Tedmorris Tedmorris is offline
Senior Member
 
Join Date: Sep 2017
Posts: 45
Default
Thx m8. Its working but now i need to figure out how to make it work for avatars and to load the image when a user clicks on the replaced image. I have the href working but it wont load in the current window/description body of the torrent description.
Reply With Quote
  #13  
Old 27-12-18, 15:06
darkalchemy's Avatar
darkalchemy darkalchemy is offline
VIP
 
Join Date: Dec 2017
United States
Posts: 80
Default
you'll need javascript for that, to load and replace the image
__________________
I do custom coding, source installs, mods, server setup and/or config, etc. Feel free to pitch me your needs and your offer.
Reply With Quote
  #14  
Old 27-12-18, 19:01
Tedmorris's Avatar
Tedmorris Tedmorris is offline
Senior Member
 
Join Date: Sep 2017
Posts: 45
Default
Yeah ive been reading up on it but im hopeless with javascript atm lol, just need to read up more on it and i should be able to work it out. The avatars though aren't looking as simple as the avatars use a variable with a query.

PHP Code:
if ($CURUSER["avatars"] == "yes")
        
$avatar htmlspecialchars($row["avatar"]);
        elseif (
$CURUSER["avatars"] == "safe" AND $row["offensive"] == "no")
        
$avatar htmlspecialchars($row["avatar"]);
        elseif (
$CURUSER["avatars"] == "safe" AND $row["offensive"] == "yes")
         
$avatar "/pic/offensive.gif";
        
//        $avatar = ($CURUSER["avatars"] == "yes" ? htmlspecialchars($row["avatar"]) : "");
        
if (!$avatar)
            
$avatar "/pic/default_avatar.gif"
Bump: I'm trying to use an external image proxy server to load http images over https. For example, a user uses the image tag on the forums of http://images2.imagebam.com/2f/9d/32/b55ec21038500004.png
By adding https://images.weserv.nl/?url=ssl: to the start of the url and stripping the http:// the embeded link becomes https://images.weserv.nl/?url=ssl:images2.imagebam.com/2f/9d/32/b55ec21038500004.png but I'm struggling to get it working in globalstar..

This..

PHP Code:
[img]http://www/image.gif[/img]
$s preg_replace("/\[img\](http:\/\/[^\s'\"<>]+(\.gif|\.jpg|\.png))\[\/img\]/""<img border=0 src=\"\\1\">"$s); 
To this..

PHP Code:
[img]http://www/image.gif[/img]
$s preg_replace("/\[img\](http:\/\/[^\s'\"<>]+(\.gif|\.jpg|\.png))\[\/img\]/""<img border=0 src=\"\\https://images.weserv.nl/?url=ssl:\1\" >"$s); 
Is outputting https://images.weserv.nl/?url=ssl:" width="150" height="150" alt=""> I'm not getting the image url inserted and I know I need to strip the http:// from it but wanted to try atleast getting the http link added to the end of the image proxy link first. The src=\"\\1\" appears to be the user inputted url but I've formatted it wrong in the modded version..

Any help would be great and much appreciated.

Bump: [QUOTE=Tedmorris;53047]Yeah ive been reading up on it but im hopeless with javascript atm lol, just need to read up more on it and i should be able to work it out. The avatars though aren't looking as simple as the avatars use a variable with a query.

PHP Code:
if ($CURUSER["avatars"] == "yes")
        
$avatar htmlspecialchars($row["avatar"]);
        elseif (
$CURUSER["avatars"] == "safe" AND $row["offensive"] == "no")
        
$avatar htmlspecialchars($row["avatar"]);
        elseif (
$CURUSER["avatars"] == "safe" AND $row["offensive"] == "yes")
         
$avatar "/pic/offensive.gif";
        
//        $avatar = ($CURUSER["avatars"] == "yes" ? htmlspecialchars($row["avatar"]) : "");
        
if (!$avatar)
            
$avatar "/pic/default_avatar.gif"
Reply With Quote
Reply

Tags
content , external , images , mixed

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT +2. The time now is 18:45. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2019, vBulletin Solutions Inc.