Hello guest, if you like this forum, why don't you register? https://fanrestore.com/member.php?action=register (December 14, 2021) x


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Few notes about the forum usage
#1
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 197Cool...

got the point? Wink want to have some space between the emoticon and your text? Just type two spaces before it Ok 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!
Reply
Thanks given by:
#2
(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.
Reply
Thanks given by:
#3
Cheers for the info, I've just gone back and fixed the links for all the pictures I've posted. Now they show up!
Reply
Thanks given by:
#4
(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
Reply
Thanks given by:
#5
(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!  Ok
Reply
Thanks given by:
#6
(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.
Reply
Thanks given by:
#7
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)
Reply
Thanks given by:
#8
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.
[Image: sNn6jyF.png] [Image: 0sPZMBH.png]
Reply
Thanks given by:
#9
Well, we all have our own lives and he might have just not had the chance to do it yet... Wink
Reply
Thanks given by:
#10
I forgot about it.

I added the script now. I wonder how many links without HTTPS support it breaks though
Reply
Thanks given by: Valeyard


Possibly Related Threads…
Thread Author Replies Views Last Post
  Forum update Feallan 10 10,341 2017-05-03, 05:04 PM
Last Post: Feallan
Exclamation Forum etiquette spoRv 4 45,956 2017-02-22, 02:20 PM
Last Post: Evit
  A couple forum changes Feallan 7 23,299 2016-12-16, 06:03 AM
Last Post: jerryshadoe
  Moving the forum Feallan 21 20,369 2016-02-22, 02:28 AM
Last Post: Feallan
  Random thoughts on this forum spoRv 2 7,473 2015-06-23, 08:47 PM
Last Post: spoRv
  Slight changes to the forum Feallan 2 4,822 2015-06-04, 11:22 PM
Last Post: jerryshadoe

Forum Jump:


Users browsing this thread: 4 Guest(s)