Posts: 7,153
Threads: 601
Joined: 2015 Jan
Thanks: 1081
Given 1463 thank(s) in 963 post(s)
Country:
Sometime may have not noted, but when I see the following things, I fix them every time; so, if you can follow these guidelines, my work - and the ones of the other mods - will be easier, thanks!
IMAGES
To insert an image, just copy the URL, but DO NOT FORGET to add the s after the http - basically, if you want your image to be showed, you must write your URL as https://yoururl.com - if you forget to use the https, or simply your image hoster can't use it, your image will appear just as a simple link.
Hint: http://postimage.io offers free image hosting since several years, it works well!
MEDIAINFO (and other monospaced fonts data)
If you post mediainfo data, and other formatted text that reads better when using a monospaced fonts, please use the CODE tag; it will be more readable, and avoid to have looong posts!
EMOTICONS
If you want to add emoticons to your text, typing directly them, please do not forget to put a space BEFORE them, to be recognized by the forum software; this is done to avoid confusion, and to let the poster to write something like this
...the movie (released in 1978)...
without having this
...the movie (released in 197 ![Cool Cool](https://fanrestore.com/images/smilies/cool.png) ...
got the point? ![Wink Wink](https://fanrestore.com/images/smilies/wink.png) want to have some space between the emoticon and your text? Just type two spaces before it ![Ok Ok](https://fanrestore.com/images/smilies/ok.png) and one after... when finally we will have a new set of emoticons, I'll plan to solve this, and add some space to the sides, to avoid double space before (single space would still be used, though) and one after.
Last thing: "preview" is your friend; use it, at least sometimes!
Thanks!
Posts: 2,250
Threads: 82
Joined: 2015 Jan
Thanks: 488
Given 842 thank(s) in 438 post(s)
2017-03-16, 07:04 AM
(This post was last modified: 2017-03-16, 09:00 AM by Valeyard.)
(2017-03-16, 03:15 AM)spoRv Wrote: Sometime may have not noted, but when I see the following things, I fix them every time; so, if you can follow these guidelines, my work - and the ones of the other mods - will be easier, thanks!
IMAGES
To insert an image, just copy the URL, but DO NOT FORGET to add the s after the http - basically, if you want your image to be showed, you must write your URL as https://yoururl.com - if you forget to use the https, or simply your image hoster can't use it, your image will appear just as a simple link.
Hint: http://postimage.io offers free image hosting since several years, it works well!
Let's just fix it with javascript or PHP. It's really not that hard.
Here are some images I want to embed:
[Image: vsJFaIF.jpg]
[Image: PA0XhLT.jpg]
[Image: 9CJPhSQ.jpg]
They will appear as text links. You can convert them with Javascript (requires jQuery) like this:
Code: <script src="/jquery-3.1.1.min.js"></script>
<script>
$('a').each(function(){
var a=$(this);
if(a.text().substr(0,4)=='[Ima')
a.html('<img src="https'+a.attr("href").substr(4)+'" alt="" />');
});
</script>
Just dump that code at the end of the <body> section, or if you prefer use an onload function:
Code: <body onload="convertimages();">
...
<script src="jquery-3.1.1.min.js"></script>
<script>
function convertimages(){
$('a').each(function(){
var a=$(this);
if(a.text().substr(0,4)=='[Ima')
a.html('<img src="https'+a.attr("href").substr(4)+'" alt="" />');
});
}
</script>
</body>
Either way works fine, problem solved. You can see it in action on JSFiddle. Be sure to put the jQuery file in the root directory of forum.fanres.com.
I thought this might be a better way to do it:
Code: <script src="/jquery-3.1.1.min.js"></script>
<script>
$('a').each(function(){
var a=$(this);
if(a.text().substr(0,4)=='[Ima'){
b='https'+a.attr("href").substr(4);
a.attr("href",b);
a.html('<img src="'+b+'" alt="" />');
}
});
</script>
But now that I think about it, if the website doesn't support TLS then you've made a bad link. Better to have a broken image with a working link then to break the link as well.
Posts: 300
Threads: 24
Joined: 2015 Jan
Thanks: 39
Given 86 thank(s) in 48 post(s)
Cheers for the info, I've just gone back and fixed the links for all the pictures I've posted. Now they show up!
Posts: 1,746
Threads: 73
Joined: 2015 Mar
Thanks: 350
Given 311 thank(s) in 141 post(s)
Country:
(2017-03-16, 07:04 AM)Valeyard Wrote: But now that I think about it, if the website doesn't support TLS then you've made a bad link. Better to have a broken image with a working link then to break the link as well.
Yeah, exactly. Maybe I'll use your script with a simple rewrite to only work with imgur - that's the most popular choice anyway, so that would probably fix the majority of broken links
Posts: 7,153
Threads: 601
Joined: 2015 Jan
Thanks: 1081
Given 1463 thank(s) in 963 post(s)
Country:
(2017-03-16, 12:52 PM)Feallan Wrote: Maybe I'll use your script with a simple rewrite to only work with imgur - that's the most popular choice anyway, so that would probably fix the majority of broken links
Good idea!
Posts: 2,250
Threads: 82
Joined: 2015 Jan
Thanks: 488
Given 842 thank(s) in 438 post(s)
2017-03-16, 02:47 PM
(This post was last modified: 2017-03-16, 02:51 PM by Valeyard.)
(2017-03-16, 12:52 PM)Feallan Wrote: Yeah, exactly. Maybe I'll use your script with a simple rewrite to only work with imgur - that's the most popular choice anyway, so that would probably fix the majority of broken links
I'd leave it as is, as it needs to work for postimg as well. The code as it is won't cause any problems. Plus users will be able to see if their image is broken, and then use another host. If you want to be robust you could add a check for the file extension in the link so you're not converting a totally junk link to an image.
I wouldn't bother implementing it server-side with PHP, personally. Unless you know for certain the code is safe against SQL injections and other vulnerabilities.
Posts: 2,290
Threads: 39
Joined: 2015 Jan
Thanks: 177
Given 187 thank(s) in 133 post(s)
I would love to see the imgur links working properly again, so I'm hoping that the script will be used be Feallan (hint, hint, cough, cough - LOL)
Posts: 2,250
Threads: 82
Joined: 2015 Jan
Thanks: 488
Given 842 thank(s) in 438 post(s)
Yep me too. Also for ImageShack... I'm surprised he hasn't put it in yet, it has no real downsides on the server-side and only a slight burden on the user.
Posts: 2,290
Threads: 39
Joined: 2015 Jan
Thanks: 177
Given 187 thank(s) in 133 post(s)
Well, we all have our own lives and he might have just not had the chance to do it yet...
Posts: 1,746
Threads: 73
Joined: 2015 Mar
Thanks: 350
Given 311 thank(s) in 141 post(s)
Country:
I forgot about it.
I added the script now. I wonder how many links without HTTPS support it breaks though
|