Would be nice with a plugin that would allow us to proxify all image urls, using img tag and so. That way we can use SSL with green certificate instead of unknown error.
Example:
https://ip.bitcointalk.org/?u=https%3A%2...H0cTp3nHeg
Orginal url / bbcode:
[img]https://mycryptocoin.us/downloads/bawls-regular.jpg[/img]
CloudFlare has free SSL, i could easily use my server for this service.. Simply encode it into that format, where we can input "image api"
in my case i would like
https://image.mydomai.com/?imgurl=
If you know a decent amount of PHP, you could try looking in the /inc/class_parser.php file where it has the regex for images.
(2014-10-21, 01:58 PM)dragonexpert Wrote: [ -> ]If you know a decent amount of PHP, you could try looking in the /inc/class_parser.php file where it has the regex for images.
I wrote this:
<?php
$x = parse_url($_SERVER['HTTP_REFERER']);
$hosts = array(
"www.domain.com",
"domain.com"
);
if (in_array($x['host'], $hosts)) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $_GET['url']);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
$picture = curl_exec($ch);
curl_close($ch);
//Display the image in the browser
header('Content-type: image/png');
echo $picture;
} else {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://i.imgur.com/58ox03y.jpg');
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
$picture = curl_exec($ch);
curl_close($ch);
//Display the image in the browser
header('Content-type: image/png');
echo $picture;
}
?>
Now I need to know how I can parse urls through it via the img tag lol
i use something this
$plugins->add_hook("parse_message", "image_relative");
function image_relative($message) {
// Assign pattern and replace values.
$pattern = array('#src="http:(.*?)#si');
$replace = array('src="$1');
while(preg_match($pattern[0], $message))
{
$message = preg_replace($pattern, $replace, $message);
}
return $message;
}
so
probably you can change
$pattern = array('#src="http:(.*?)#si');
with
$pattern = array('#src="(.*?)#si');
and
$replace = array('src="$1');
with
$replace = array('src="https://image.mydomai.com/?imgurl=$1');