News:

Wondering if this will always be free?  See why free is better.

Main Menu

Embed Instagram BBCode

Started by dougiefresh, June 23, 2015, 02:36:27 PM

Previous topic - Next topic

villasg


Ninja ZX-10RR

This is a pretty good mod. Just to throw out an idea, could you make it automatic as well? Let's say an user posts a link without wrapping it, the mod recognizes it and wraps it automatiically? I am testing this, the tumblr one and the facebook one as well, don't know if it works for those but it would be nice.

And congrats for so much code dougie! :)
Quote from: BeastMode topic=525177.msg3720020#msg3720020
It's so powerful that on this post and even in the two PMs you sent me,you still answered my question very quickly and you're apologizing for the delay. You're the #1 support I've probably ever encountered man, so much respect for that. Thank you, and get better soon.

I'll keep this in my siggy for a while just to remind me that someone appreciated what I did while others didn't.

♥ Jess ♥

STOP EDITING MY PROFILE

Ninja ZX-10RR

Further testings show that the mod fails 3 times at XHTML validation.

[quote]
Error Line 325, Column 191: there is no attribute "allowtransparency"
...="0" scrolling="no" allowtransparency="true"></iframe></div></div><br /><a cla...

You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).

This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.

How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute. If you received this error when using the <embed> element to incorporate flash media in a Web page, see the FAQ item on valid flash.

Error Line 325, Column 400: "async" is not a member of a group specified for any attribute
...e - Nick and Leezy 😍</a><script async src="//cdn.embedly.com/widgets/platform....

Error Line 325, Column 459: required attribute "type" not specified
...ync src="//cdn.embedly.com/widgets/platform.js" charset="UTF-8"></script></div>

The attribute given above is required for an element that you've used, but you have omitted it. For instance, in most HTML and XHTML document types the "type" attribute is required on the "script" element and the "alt" attribute is required for the "img" element.

Typical values for type are type="text/css" for <style> and type="text/javascript" for <script>.

The async is just annoying, I had the same issue before with other things, while the third one is easy to fix and it's annoying as well since it's not going to throw any error in HTML5 while it does in XHTML. On the other hand, I am unsure about the first.
Not suggesting the fixes, it's going to take more time to actually c/p them rather than fixing those for ya ;D

Quote from: Ninja ZX-10RR on August 24, 2015, 10:50:42 PM
This is a pretty good mod. Just to throw out an idea, could you make it automatic as well? Let's say an user posts a link without wrapping it, the mod recognizes it and wraps it automatiically?
*bump* missed? :)
Quote from: BeastMode topic=525177.msg3720020#msg3720020
It's so powerful that on this post and even in the two PMs you sent me,you still answered my question very quickly and you're apologizing for the delay. You're the #1 support I've probably ever encountered man, so much respect for that. Thank you, and get better soon.

I'll keep this in my siggy for a while just to remind me that someone appreciated what I did while others didn't.

♥ Jess ♥

STOP EDITING MY PROFILE

dougiefresh

@Ninja ZX-10RR: I'm working on both of the issues you mentioned.  I've got the auto-embedding code figured out....  Trying to fix the HTML/CSS output so that the entire Instagram thingy is shown without scrollbars...  To test, look at this:
[instagram]https://instagram.com/p/6HCv5FQzGO[/instagram]

Ninja ZX-10RR

#24
For the auto-embedding I should have mentioned... Just do it the way Suki did for the Youtube mod, got to admit it's pretty good besides a stupid XHTML error that I fixed myself in the topic :)

Going to have a look at that scrollbar thingy, if it's css-related I'm pretty sure I can help with that. Will edit/post again in a while if necessary. EDIT 1: not sure what you mean with that, I tried the link you provided and yes you get a scrollbar on low-res, but it's SMF-side, not mod-side. SMF was never designed to be responsive until they tried to roll out that responsive mod thingy which partly did it. I'm going to have a look if my fully responsive default is being broken by the mod itself, hang on. EDIT 2: no, it doesn't, but the Tumblr mod does break it (breaks on hover due to the lateral blocks moving everything up and down).

And of course thanks!
Quote from: BeastMode topic=525177.msg3720020#msg3720020
It's so powerful that on this post and even in the two PMs you sent me,you still answered my question very quickly and you're apologizing for the delay. You're the #1 support I've probably ever encountered man, so much respect for that. Thank you, and get better soon.

I'll keep this in my siggy for a while just to remind me that someone appreciated what I did while others didn't.

♥ Jess ♥

STOP EDITING MY PROFILE

dougiefresh

Uploaded v1.8 - August 27th, 2015
o Added ability to auto-embed Instagram URLs to the mod.
o Adjusted CSS file "padding-bottom" property from 100% to 112% to show entire embed.

Ninja ZX-10RR

Didn't have that issue on my forum O.o the auto-embed is working as intended (nice!), but the XHTML still fails, and checking again I have no idea how you could fix it, because it looks like it's Instagram side...?
Quote from: BeastMode topic=525177.msg3720020#msg3720020
It's so powerful that on this post and even in the two PMs you sent me,you still answered my question very quickly and you're apologizing for the delay. You're the #1 support I've probably ever encountered man, so much respect for that. Thank you, and get better soon.

I'll keep this in my siggy for a while just to remind me that someone appreciated what I did while others didn't.

♥ Jess ♥

STOP EDITING MY PROFILE

villasg

Hello again .
I try to unistall the 1.7 and replace with 1.8 but receive errors in Post.php when try uninstall .
package in uninstallation search for '<img><iframe> to replace with '<img> 2 times .
But have this 2 lines with this and look like
line 1534 if ($smcFunc['htmltrim'](strip_tags(parse_bbc($_POST['message'], false), '<img><div><div><iframe><iframe><div><iframe><div><iframe><div><object><embed><div><iframe>')) === '' && (!allowedTo('admin_forum') || strpos($_POST['message'], '[html]') === false)) $post_errors[] = 'no_message';

line 2747
if ($smcFunc['htmltrim'](strip_tags(parse_bbc($_POST['message'], false), '<img><object><embed><iframe>')) === '')


Any help again please

dougiefresh

Quote from: villasg on September 02, 2015, 01:46:55 PM
Hello again .
I try to unistall the 1.7 and replace with 1.8 but receive errors in Post.php when try uninstall .
package in uninstallation search for '<img><iframe> to replace with '<img> 2 times .
But have this 2 lines with this and look like
line 1534 if ($smcFunc['htmltrim'](strip_tags(parse_bbc($_POST['message'], false), '<img><div><div><iframe><iframe><div><iframe><div><iframe><div><object><embed><div><iframe>')) === '' && (!allowedTo('admin_forum') || strpos($_POST['message'], '[html]') === false)) $post_errors[] = 'no_message';

line 2747
if ($smcFunc['htmltrim'](strip_tags(parse_bbc($_POST['message'], false), '<img><object><embed><iframe>')) === '')


Any help again please
:o I've gone over something very similar with you here.  All I've done is alter the source file so that it matches what is expected.  ::)

In other words, if the mod expects <img><iframe> and you have <img><div><iframe>, you need to change the order of the tags (as the order isn't revelant to the function using them) so that you get <img><iframe><div>8)  The fact that you can find the issue suggests to me the ability to correct this minor issue on your own....   You can even go further and eliminate the duplicates from the string that we are editing....

That having been said, here is what you need to change the lines to:
Code (Line 1534) Select
if ($smcFunc['htmltrim'](strip_tags(parse_bbc($_POST['message'], false), '<img><iframe><div><div><iframe><div><iframe><div><iframe><div><object><embed><div><iframe>')) === '' && (!allowedTo('admin_forum') || strpos($_POST['message'], '[html]') === false))
Code (Line 2747) Select
if ($smcFunc['htmltrim'](strip_tags(parse_bbc($_POST['message'], false), '<img><iframe><object><embed>')) === '')

Btw, as an off-topic note, SMF 2.1 deals with this different by adding all the tags it doesn't need to strip out in an array and collapsing the array for use by the strip_tags function.  This mod, when installed on SMF 2.1, adds the tag to the array and uninstalls properly without the need for this kind of modification.....

bjornforum

Hi! Thanks for your mod.
I do have a problem though: As soon as I install the modification, the bbcode settings in configuration -> Forum -> Topics & posts -> Bulletin Board Code disappear. Only the 'enable all bbcode' checkbox stays visible.

See attached screenshot.

dougiefresh

Uploaded v1.9 - Septmber 6th, 2015
o Fixed issue where BBCodes list was completely empty because of mod... (shrug)

bjornforum

Thanks!
Would you be able to also add Vine for embed?


dougiefresh

#32
From the little bit of research I did this morning, it looks like Vine is seperate from Instagram....  So I'll can do a different mod to address this request, since the two don't really belong together IMHO....

Ninja ZX-10RR

As long as it doesn't have arrogant javascript inside of it ;D
Quote from: BeastMode topic=525177.msg3720020#msg3720020
It's so powerful that on this post and even in the two PMs you sent me,you still answered my question very quickly and you're apologizing for the delay. You're the #1 support I've probably ever encountered man, so much respect for that. Thank you, and get better soon.

I'll keep this in my siggy for a while just to remind me that someone appreciated what I did while others didn't.

♥ Jess ♥

STOP EDITING MY PROFILE

dougiefresh

#34
UPDATE: Just for giggles, I took a copy of the Instagram mod and modified it for Vine Videos.  It's here, but it's currently unapproved.  I'm going to try to get it up on my forum over at www.xptsp.com shortly....

Quote from: Ninja ZX-10RR on September 07, 2015, 09:00:25 AM
As long as it doesn't have arrogant javascript inside of it ;D
Nope, it's a simple iframe mod.  No javascript involved!   :P




EDIT: It's available on my website: Embed Vine Video BBCode.


TLMB

Brilliant. Thank you very much!

May I suggest disabling the mod within code tags? I mean, I know it doesn't embed within code tags, but it does add the [ instagram ] tags, which means I can't tell users "just post the link, like this", because then they might think they have to add the tags.
A minor point, I admit. :)

dougiefresh

Okay, I'll make that change.....

dougiefresh

Uploaded v1.10 - September 21st, 2015
o Fixed auto-embedding issue where URLs inside code tags where auto-linked.

TLMB

Thank you.
But how do I upgrade? Trying to install v1.10 tells me "it's already installed", but trying to uninstall v1.9 gives me Test Failed on
Quote*    2.    Execute Modification    ./Sources/Post.php    Test failed
      1.    Replace    ./Sources/Post.php    Test failed
      2.    Replace    ./Sources/Post.php    Test failed
*    3.    Execute Modification    ./Sources/Subs.php    Test failed
      1.    Replace    ./Sources/Subs.php    Test failed
I also have Antes' Tweet embed mod and your facebook embed mod installed. Any conflict there?

TLMB

Update: I uninstalled your two mods in the reverse order that I installed them, and then installed the latest version of each, successfully.

Unfortunately I'm now getting a "the message body was left empty" error when I try to edit a post that has some instagram links in, amongst other stuff. (Googling suggests this may be to do with too many bbcodes in one post.) The post is shown as blank, even though clicking "modify" loads the post's full content in the edit window.

My forum now tells me that I have Subs-Post.php version 2.0.8 , and the latest version is 2.0.10. I'm running 2.0.11. I suspect it may be to do with this? Tempted to try your Faster BBC Parser mod to see if that magically fixes things... :)

Advertisement: