Another WIP addon,
*** Note *** this is now built into ElkArte 1.1.x
This one is my conversion of ILA, in line attachments. Right now all the hooks are in place so the ILA tags render, placing the image in line with the text. Whats missing is the easy tag placement in the editor, so for now you have to add an attachment as normal, and then in the text, enter the ILA tag where you want the image to display.
I'm not sure what direction I may take with the editor, so for now .....
In Line Attachments v1.0
LicenseThis addon is released under a MPL V1.1 license, a copy of it with its provisions is included with the package.
IntroductionThis addon adds the ability to position your attachments in your post, like the IMG tag, using newly created BBC codes. This is useful for inserting attachments inline with your text. Several types of attachments are possible such as : full-size, thumbnail or link. For each attachment you can select how and where the attachment appears within the message. You can also use the same image in multiple areas in the same post. You can of course still have the attachment at the bottom of the post as is the ElkArte default.
Features- Adds new bbcodes to position attachments within the post, note n is the number of the attachment in the post, eg first = 1, second = 2, etc
- [attachimg=n] (full size image)
- [attach=n] (thumbnail image)
- [attachurl=n] (link with view/download count)
- [attachmini=n] (simple link)
- Use simple [attach] tag to insert the added attachments sequentially
- Adds optional align and width attributes as [attachimg=1 align=left width=80]
- Align can be left, right or center. For left and right aligns the text will flow around the image
- Width works on attachimg, if the specified width is less than the image then a link (or highslide) is added to one to view the full sized image
- The default placement of attachments at the bottom of the post is unaffected for the attachments that were not used in line.
- Works in all areas of the board such as new posts since last visit / all posts of user / new, reply, modify messages / Topic/Reply History.
There are some basic admin settings available with this mod, go to admin - configuration - addon settings - ILA. Here you can disable/enable the addon.
/me smells good stuff here!
What is the status of this add on ?
I think that this add on should be integrated into ElkArte :)
It is currently lacking the posting interface, so right now you have to manually add the [attach] bbc codes. I have to spend some time on figuring out a decent interface to insert the codes.
There was talk about doing that for 1.0 (very early on), you may see it in 1.1, depends on getting the UI and some more testing, there are quite a few unusual conditions that it has to handle !
Tried it on my new Elkarte test install, but I get a parse error on testing:
Extract File ./themes/default/css/ILA.css Modification parse error
This is on a vanillaElkarte install. Any ideas?
Because Spuds is testing on windows where ILA.css and ila.css are the same file, while on *nix is not. :P
damn Windows users :D
I earn my living now as a Senior Wintel engineer but started out on Amigas and Solaris back in Windows 3 era.
Doh .,.. what he is saying is sometimes I'm about as sharp as a bowling bowl ! I've only made that same error like 1000 times !
/me uses linux not to do these errors, but can do much more funny ones! :P
https://bitbucket.org/spuds_/elk_ila
one of my favourite addon, is working with ELK 1.0.0 ;)
Glad its working for you :D ... I still need to add a post screen interface, I'm just still undecided what I want to do for that,
I sow that I have to insert manually the bbcode for inline images, but for now is enough, I am using your SMF mod on my forum and if I'll convert to Elk I wont loose the inline images ;) (the pagination I mean, not the attachments).
And it also works with Fancybox, another addon that I like (less features than HS4smf but still a great one)
There is a problem with this mod and simple portal. I don't kow if is related to SP or ILA.
I have a block "Board news" where I insert the images inline floatet to left. In smf is working fine, but not on Elk. I attach 2 images to explain better
p.s. I can also provide an account if someone want to take a look.
Looks like its not finding the image. to display?
but it topic view I can see the image:
skodaclub.it/skodaelk10/
Now I remember that bug from SMF days, its due to the $topic not being set when coming in from a portal page. If you look at the links on those images they say topic=0.0 I'll get that fixed in a bit.
sorry if I insist, but was this solved? thank you in advance
Not resolved but not forgotten either ... will get it fixed soon, I promise !
Please replace your ILA.subs.php with this one and let me know if it resolves the issue.
yes, the inline images are showed correctly on portal ;D
there is another problem with the titles:
skodaclub.it/skodaelk10/index.php
Thats the floats acting up ... you can try adding
.sp_article_content .righttext {
clear: both;
}
to portal.css ... after the .sp_article_content selector. May be a better way but that should work.
that worked, thanks!
In the admin settings...what does "(ILA) Only show basic ILA menu" do?
for now nothing, in the old version for SMF it was showing a dropdown menu from where you could set the position. Once set the position the mod adds the bbcode. For now ILA for elkarte is WIP (work in progress) and you should write the bbcodes manually.
Thanks for the info. I thought maybe I was supposed to be seeing something when I checked it...but I wasn't. :)
In these days I keep an eye on my error log and I found something regarding the ILA addon: when a user insert a .pdf attacchment and use the code [attachurl=1] I get thison my error log:
Tipo di errore: Generale
Too few arguments: URL http://www.skodaclub.it/index.php?topic=2388.0
File: /....***/sources/subs/ILA.subs.php
Riga: 56
---edit---
I know this addon is wip, but in the future would be nice to have responsive images inserted with [attachimg=x]
Spuds: in the perspective to bring this into the code (at some point :P), what would you think if the attachments are created exactly the moment they are uploaded and passed the tests? Without waiting for the message to be posted?
Thinking quickly about it I would see as pro:
* [attach=1] could become [attach=123] where 123 is the attachment id (that should save some hassles),
it would allow to simplify the code related to handling attachments in session during posting (we could just store the attach id),
probably something else
In the con list I would add:
less "easy" to remove them when not used (well, not exactly but it would be slightly difficult to identify them)
the id attach could growth slightly faster.
into the core, right? ;) I like the idea, I imagine this will not happen before 1.1 release
I don't know if this is so good, because you also have to find a solution to convert the existing inline attachments for those who are using this addon. Some softwares like XF are using inline attachments into core and they are using the same bbcodes as elkarte attach=x and attachimg=x (where x is not the attachment id, but the id of attachment into that post) so you will have to do some extra work on open importer.
Thanks for the bug report, I'll take a look. {eta line 56? could you post your subs file, in mine thats a comment line)
RE core ... yeah we have to think about this some for sure, they way it works now is complicated having to do the translation from post ID to real ID. But then there are complications when you go to edit, so you would have to turn it around so it made sense to the poster (meaning =1 or maybe =attachment name) vs =123873 ...
Actually I think its the quote checking that is the most complicated anyway, when I did the mod there was one user who really beat the heck out of it and found all sorts of cool usage cases that I had to work around.
I have not looked at that code since I posted the WIP O:-) I really should !!
Please remember about this, maybe is just a simple trick with css, but I don't know how to solve it
I posted the original in the wrong topic... sorry.
A similar approach to the one for normal images would be to edit ILA.subs.php this way:
<img src="' . $this->_attachment['href'] . ';image" alt="' . $uniqueID . '" title="' . $ila_title . '" id="thumb_' . $uniqueID . '" style="width:' . $this->_curr_tag['width'] . 'px;" />
</a>';
else
$inlinedtext = '<img src="' . $this->_attachment['href'] . ';image" alt="" title="' . $ila_title . '" id="thumb_' . $uniqueID . '" style="width:' . $this->_curr_tag['width'] . 'px;" />';
<img class="bbc_image resize" src="' . $this->_attachment['href'] . ';image" alt="' . $uniqueID . '" title="' . $ila_title . '" id="thumb_' . $uniqueID . '" />
</a>';
else
$inlinedtext = '<img class="bbc_image resize" src="' . $this->_attachment['href'] . ';image" alt="" title="' . $ila_title . '" id="thumb_' . $uniqueID . '" />';
TBH I'm not sure about the name of the classes amd I can't find a bbc image at the moment sorry.
I tried but the imge goes out of the forum layout. That code ignore the width tag
ex:
[attachimg=1 width=800]
:-[
Looks like I have to better study the code... sorry.
I'm having a little problem with this addon, yesterday I was watching my drafts and I sow 15 pages of drafts, I tried to go to next page of drafts but an error showed. In elkarte error log I see:
Tipo di errore: Critico
Wrong value type sent to the database. Integer expected. (msg)
Function: _ila_get_topic URL http://www.skodaclub.it/index.php?action=profile;area=showdrafts;u=1
File: /../../skodaclub.it/sources/subs/ILA.subs.php
Riga: 729
I tried to delete my drafts, but I was not able.
Now I cannot see my drafts, when I go in drafts I see Wrong value type sent to the database. Integer expected. (msg)
In error log I got the same error above. How could I solve this?
I'll take a look at this today ... sorry for the delay !
hi,
there is a problem
do not add adds new bbcodes
I tested wamp server and active host
Hi,
I'm sorry I got it wrong.
the fact that the example in the picture
I would hope that in the new version :)
(
sorry my english very bad)
Good suggestion ... was thinking along those lines as well.
With
@Spuds blessing I started looking at integrate this into 1.1 and the current step in terms of code is here: https://github.com/emanuele45/Dialogo/tree/ila
While attached to this topic an example of the current result. O:-)
Clicking the icon the tag is automagically inserted into the editor.
There are a couple of potential issues here and there (still), but hopefully before 1.1 final is released will be fixed! ;D
ETA: one of those issues is that I don't like the icon I picked. LOL
Any fontawesome suggestion would be awesome! :D
That is a great news! I love the idea. Most forums have this into core, even Kunena ;)
If could be useful a screenshot from XF:
Looking good :D ...
RE the icon ... maybe the anchor or the file-image-o ?
For the moment I unified the "uploaded attachments" and the "newly uploaded" interfaces, so that now all are show the same way! Having just one interface it becomes easier to deal with changes. O:-)
Have a look at XF interface is handy for sure! :D
What I think we should do is (even though we are going a little OT but I hope Spuds will not kick us from the topic... O:-)):
1) drop the 100% progressbar, when the file is uploaded is a bit useless;
2) add the thumbnail;
3) I was using icons to avoid words for consistency (and because it's usually easier for translation, theming and coding :P), but maybe words are the best option?
Little example of the current state. :D
Wow coolio :D
today a member sent me a PM with a critical error. He told me that he got that error when looking into drafts. I have no other information, in the error log I got:
7630ef95227de92c28f925fa7de35e28
Tipo di errore: Critico
Wrong value type sent to the database. Integer expected. (msg)
Function: _ila_get_topic URL http://www.skodaclub.it/index.php?action=profile;area=showdrafts;u=511
File: /../sources/subs/ILA.subs.php
Raw: 729
I checked my drafts but I was not able to reproduce this error. Anyone else with this error?
In the error log, in the last week I only see 8 of this errors, but all are from the same user.
That would be a bug with inline attachments ...
I'd say they saved a draft using the ILA tags which the system is trying to fulfill one way or another. I should be able to reproduce this and come up with a fix this weekend.
Please don't forget about this :D
you can see it here: skodaclub.it/index.php?topic=1683
Yeah it's a missing max-width: 100% on images.
I don't know if it's a good solution but I solved the problem with responsive images inserted with [ attachimg=x ] by changing the line 531 in ILA.subs.php from
$inlinedtext = '<img src="' . $this->_attachment['href'] . ';image" alt="" title="' . $ila_title . '" id="thumb_' . $uniqueID . '" style="width:' . $this->_curr_tag['width'] . 'px;" />';
to
$inlinedtext = '<img src="' . $this->_attachment['href'] . ';image" alt="" title="' . $ila_title . '" id="thumb_' . $uniqueID . '" style="max-width: 100%;" />';
I think it should work, I don't know if
@Spuds has other coding standards or something, but it works and it's responsive regardless of the selected theme :)
I know it does, because I had tried it :P
Tracked for 1.1 https://github.com/elkarte/Elkarte/issues/2191
ETA: just to explain why "1.1 beta 2", I set it as "blocker", so no release until it's fixed, but is a little tweak, so if it is fixed for beta 1 good, otherwise it must be fixed for beta 2. :)
I also found error for "1.1 beta 2" => https://github.com/elkarte/Elkarte/issues/2189.
if this addon it will be in the core maybe you have to revisit openimporter and/or ILA, because most forums had inline attachements into core and most of them are using the same bbcode [attach=x) or [attachimg=x) where x is the id of attachment in the forum, not in topic. ILA is not using the id of the attachment in the whole forum, but the id of attachment in that topic. With the first solution you can embed an attachment inline in different topics.
There could be a "compatibility mode", where the id is the attachment id instead of the message id?
Or the other way around: change ILA code to use the attachment id and have a compatibility-mode that uses the message attachment id?
Installed, works fine. German translation added. Is there any need of translating the help text? I didn't find where the translation is used anyway.
Some news on the editor problem?
I don't know if this addon will be updated, probably it will be included into the next major release 1.1
Maybe Emanuele or Spuds can give us more information
ILA has been merged into 1.1, so its unlikely that I will update this 1.0 version. The main missing part from this version was the UI in the posting page, so I may add something but I'm in no rush.
However bugs are welcome to be reported since it this has bugs then of course they exist in 1.1 as well ! I
thinik @emanuele also added the ability to call a specific attachment by id in 1.1 vs the post "owned" numbered approach here.
Thanks for the translation :D ... yeah no need on the help translation since that ? icon to bring it up is missing in this version ... and the version in 1.1 will be somewhat different.
Yep, for the moment I changed it to:
[attach]123[/attach]
because is the easiest and allow to add more stuff as parameter.
We will probably want to have a conversion from 1.0 addon to 1.1 core O:-)
Yep, that is one more thing to do... :-\
But I was thinking of pushing it to beta 2 since it's not "really" urgent (because anyway I used a different tag, so the "old" ila can still live on its own).
Just something to track for 1.1 GA .. does not need to be in the betas for sure, but would be nice to have an upgrade (even if its a separate utility that gets run)
I'm having some errors in ElkArte log for the attachments inserted with
[attachurl=1]
In my case there are two pdf inserted inline, it's an old topic imported from SMF+ILA
Type of error: General
sprintf(): Too few arguments
File: /../sources/subs/ILA.subs.php
Line: 561
where line 561 is:
</a> (' . $this->_attachment['size'] . ($this->_attachment['is_image'] ? ', ' . $this->_attachment['real_width'] . 'x' . $this->_attachment['real_height'] . ' - ' . sprintf($txt['attach_viewed'], $this->_attachment['downloads']) : ' ' . sprintf($txt['attach_downloaded'] . $this->_attachment['downloads'])) . ')';
I don't know id it worth to fix it now or wait for the 1.1 release ;)
sprintf($txt['attach_downloaded'] . $this->_attachment['downloads'])
I assume that . is meant to be a ,.
That looks like the fix to me as well ....
Yep, that solved my problem, thank you!
Doesn't seem to work in the preview?
Oh, sorry. Try again please.
Ok, the main problem is that the size of the thumb is smaller than the size of the image:
http://forum-alternative-antriebe.de/index.php?action=dlattach;topic=5858.0;attach=7555;image
is 150px wide, while the ILA is 250.
I seem to remember ILA thumbnails are created from the normal attachment thumbnails, so... make the normal thumbnails bigger in the admin panel:
admin > forum > attachments and avatars > attachment settings
down in the thumbnail settings use something like 250 or 300.
Then, you'll get bigger "normal" thumbnails, that you will fix adding:
.attachment_thumb > a > img {
max-width: 150px;
}
to your custom.css... I hope. :P
I changed this to 250px max. It works without changing the custom CSS. 250px is okay with me.
:D
A member attached three pictures and used the code
attachimg for all three images. This is what happened:
http://forum-alternative-antriebe.de/index.php/topic,2279.msg119188.html#msg119188
That can't be good for the seats… oh right, the issue.
It looks like .quickbuttons::after does a clear:both, but maybe .quickbuttons should too?
Don't know what happened, as guest seems fine, beside the fact that images inserted with attachimg are not responsive. I posted a solution in this thread if you are interested ;)
Maybe it's browser specific? Firefox 54 here...
Just make your window a little less wide and it won't occur.
Try adding this "somewhere" (i.e. custom.css):
.inner:after {
content: "";
display: block;
clear: both;
}
So now I upgraded from 1.0.x to 1.1.3 and the old ILA code is not working any more, as you can see here:
https://forum-alternative-antriebe.de/index.php/topic,7575.0.html
I installed the addon again, but it's not working (even when I edit a post and save it again). That's something I feared. :-X
I thought ILA is a default feature in 1.1, right?
Yes it is and it works great.
Thank you for confirming that
@b4pjoe. I guess you have to remove that addon
@Jorin as it may be conflicting with the default?
The addon uses a completely different BBC then the standard feature in ElkArte 1.1. So 1.1 can't show inline images made with the addon. And the addon doesn't work with 1.1.
A stupid question.
How do I insert an ILA in 1.1.x if it is default there? By BBC tags? But between the others I can't find any for the ILA ... :-[
This was or still is an addon. It can be installed with the package manager. ;)
It can be installed but it no longer works and yes that is right, ILA made with the addon no longer show the images in 1.1.x.
The BB code for the ILA in 1.1.3 is:
[attach width=400]XXXXX[/attach]
but you don't know what XXXXX is to start with. Once you add the attachment to a post you click this button which gives the options to attach the image inline:
Select your options and it adds the BB code like this:
[attach width=300]post_tmp_40_fbae146c99437cf483d1a31e1a0e3f7a[/attach]
with a temporary name that it changes to the permanent name after you post your message like this:
[attach width=300]5862[/attach]
I also used ILA add-on on elkarte 1.0.x and after updating to elkarte 1.1 I did not installed this add-on. I am using the inline images function included into elkarte 1.1. I know old attachments are not displayed inline, so I did a search and replaced most of them manually. Not the best solution but I didn't have alternatives. Ila add-on was used only by a few members because there was no menu to place inline images and people hate to write bbcode
I know that and this has nothing to do with my problem. But thanks for explaining others how to use the default feature. ;)
Sorry, I added the instructions for Mrs. Chaos question.
Oh, sorry. :-[
Aha, okay. I thank both of you! :)
I promised to look if the problem can be solved via SQL. That's what I archieved right now:
select att.id_msg, att.id_attach, msg.body
from elkarte_messages msg, elkarte_attachments att
where att.id_msg=msg.id_msg
and att.attachment_type=0
order by 1,2;
...selects all messages with attachments that are not thumbnails (because we only want the real images, not the from Elk created thumbnails), sorted by message and attachment id. That's a list we can work with. Now we create a help table to work with:
create table help_msg_attachments
(
msg_id int(11),
attachment_id int(11),
body longtext,
body_new longtext,
ordinal int(11)
)
CHARSET=UTF8;
Now we can fill the table, first with only one message to play with:
insert into help_msg_attachments (msg_id, attachment_id, body)
select att.id_msg, att.id_attach, msg.body
from elkarte_messages msg, elkarte_attachments att
where msg.id_msg=91684
and att.id_msg=msg.id_msg
and att.attachment_type=0
order by 1,2;
Next step: We must find out how we handle different alignments and different types of old ILA codes (for example thumbnail or image). Maybe we have to skip this and only use thumbnails without alignment for the converted codes? Don't know the best solution right now as I used both with the old addon. Alignment for my car reviews, no alignment in other threads.
@radu81 Where is this included inline images function??? Except the BBC tag for normal inserting of images, I can't find anything. :-[
Go to Admin > Forum > Attachments & Avatars > Attachments settings, and scroll down, the last setting should be "Enable inline attachments"
Oh, I get an error message there:
count(): Parameter must be an array or an object that implements Countable
What does that mean exactly?
All other pages under "Attachments & Avatars" are working normally.
https://www.elkarte.net/community/index.php?topic=5228.0
Probably the same issue as there?
Yes, thank you, that was it. :)
Just the alteration, that is suggest by Emanuele there, worked.
Is there a new BBC button for this, that I can or must add, or do I have to write allways something in the text like [attach] ?
Yes, there is a button
I've tried it now. Everything works and looks great.
Thank you guys! :)
Read this thread because I'm interested in the solution .. but I cannot find the "share" button on my attachments. So, I can't use that temp image file name in the [attach] tag. What could be wrong?
Are you using Elk 1.1 and the default theme? Just wanted to check first since this addon is not required in 1.1 (its build in)
Sorry, guess I was too short in my description (and probably also in the wrong place). I have tried the add-on, it didn't seem to do anything, and then after I found this old thread I uninstalled it.
Bottom line, now I am on v1.1.6, and use the Default Theme .. and on the list of attachments the only button that shows is the "delete" button.
If you are on 1.1.6 you don't need this add-on, just uninstall it if you have it installed.
To use inline attachments in elkarte 1.1 you need to go to: Admin -> Forum -> Attachments and Avatars -> Attachments settings and enable the option Enable the display of in line attachments
Yes, I did that .. my problem is how to get to the link. In one of the earlier posts a screen shot is shown where there are options next to an attachment:
.. and I don't have this button, not to speak of it's options. The only button visible is the delete button.
that's strange, if you are using 1.1.6 with that option enabled you should see that button.
ohhh wait ... I just wanted to see if another theme would show different results. I switched the layout, and the button was there! Then switched again, back to the default theme .. and the button is still there!
Not sure what happened here. Could it be that my tests with the obsolete plugin confused some of the theme styles or layout?
Either way, the problem seems to be gone. Thanks for taking the time to reply!
Miracle solved, I think .. I'm using an ad/popup blocker, and as it stands it prevents the button from being displayed. Whitelisting my forum domain helped.
As a tip to others .. before you chase weird effects make sure to try with ad blockers disabled!
Good to know, thanks for sharing ;)