News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Attachments In Message

Started by slinouille, June 03, 2008, 04:02:21 AM

Previous topic - Next topic

engr_dood

Quote from: Spuds on February 18, 2010, 01:40:32 PM
Here is the latest revision, it should fix the problem you, and others, were having with images not expanding when they were clicked.

It works!  Thanks a bunch.

If you need someone to do more testing, I have a snapshot of our forum here on my LAN.  I can do whatever testing is needed without affecting users of the main forum, and I'm willing to do so.

engr_dood

I've done some more testing and found a problem with non-graphic files and [attach=].  Actually I've only tested this with a zip file, but I'm assuming it's related to non-graphics files rather than zip files in particular.  I tried creating a new post, attaching an inline zip file using [attach=], and this caused the post rendering to be just a blank area after pressing the Post button.  IOW, there was no icon/button to be able to modify the post to take the offending tags out.  The entire post (and page) was blank below the post's title bar.  If I log out of the forum and just view the post as a guest, the post renders just fine (guests are disallowed from viewing attachments), and what's seen is just the [attach=] tags.

So I went back and looked at some posts that had already been created with the 1.1.11 software and quake101 mod, which contained zip files posted with [attachment=].  Sure enough, the rendering of these was just a blank area as well.  I've attached to this post a graphic capture of a post that triggered the problem, as viewed with 1.1.11 and the quake101 mod.  That file link along with the graphic is always included in the quake101 mod, which I find convenient.  This graphic also illustrates a bug with the quake101 mod in which the zip file is shown twice, once as inline and once as a normal attachment at the end of the post.  It was actually only attached once, with a single [attachment=].

engr_dood

The rendering of the non-image files is looking good now.  Thanks!

I just noticed another minor bug though.  The combo box next to the "Browse" button for the first attachment has strings and corresponding inserted codes in the following order:
1) String = "Normal SMF Attachment", code = none
2) String = "Inline mode - Thumbnail if available, else Full", code = "[attach=1]"
3) String = "Inline mode - Thumbnail Always", code = "[attachthumb=1]"
4) String = "Inline mode - Full-size image", code = "[attachimg=1]"
5) String = "Inline mode - Text link", code = "[attachurl=1]"
6) String = "Inline mode - Short Text Link", code = "[attachmini=1]"

This all looks right.  But the combo boxes for the second and higher-numbered attachments have the strings in a different order, with codes that don't match the strings in two cases.  They look like this for the second attachment:
1) String = "Normal SMF Attachment", code = none
2) String = "Inline mode - Thumbnail Always", code = "[attach=2]"  (should be "[attachthumb=2]")
3) String = "Inline mode - Full-size image", code = "[attachimg=2]"
4) String = "Inline mode - Thumbnail if available, else Full", code = "[attachthumb=2]" (should be "[attach=2]")
5) String = "Inline mode - Text link", code = "[attachurl=2]"
6) String = "Inline mode - Short Text Link", code = "[attachmini=2]"

engr_dood

Fixed on both counts.  Woohoo!  ;D ;D ;D ;D

Combo box ordering is good and the codes match for all combo boxes now.  Text message about guests and attachments is good.

BTW and FWIW, I"m using Firefox 3.6.  I have IE8 installed but haven't tried it yet.  Tomorrow I'll do some more exhaustive testing with both browsers.  This is looking really, really good.  I'm the admin of a forum for electrical engineers who post lots of schematics, graphs and things like that, interspersed with text.  This is a key part of how we communicate, and really important to us.  I was worried about a potential dead-end situation with 1.1.11 and the quake101 mod - which hasn't been updated in a long time.  This looks like the way forward.

Thanks much!

engr_dood

Hi Spuds,

I've had a chance to do some more thorough testing.  It looks like there's still a glitch with the matching of the codes and strings in the first combo box displayed.  This shows up the exact same way in both Firefox 3.6 and IE8 (which needs compatibility mode to fix a scrolling issue).  Now the strings are in the same order for all combo boxes, but the first combo box has two codes swapped.  Here are the strings and codes for the first combo box.

1) String = "Normal SMF Attachment", code = none
2) String = "Inline mode - Thumbnail if available, else Full", code = "[attach=1]"
3) String = "Inline mode - Full-size image", code = "[attachthumb=1]" (should be attachimg)
4) String = "Inline mode - Thumbnail Always", code = "[attachtimg=1]" (should be attachthumb)
5) String = "Inline mode - Text link", code = "[attachurl=1]"
6) String = "Inline mode - Short Text Link", code = "[attachmini=1]"

For the second and subsequent combo boxes, the strings are in the same order, but the codes for attachthumb and attachimg are not swapped - they are correct.  There's a second bug I found, but I'll describe it in a separate post to minimize clutter.

engr_dood

The second bug is a bit tricky.  It's tricky because I thought I had the steps to repeat down pat, but seemed to get inconsistent and somewhat random results.

It happens when I have multiple inline attachments mixed in with a normal SMF attachment that isn't the last attachment added.  If I post such a message, then go back and modify it, the attachment list with the checkboxes (for removing attachments or adding the inline code) sometimes lists the files out of order, which ends up assigning the incorrect attachment number to one or more files.  Here's an example of some files which were added in order sorted by name, with the given attachment properties.

Attachment 1: cherry_block.png (used attach=1)
Attachment 2: include_Zin_block_1.jpg (used attachimg=2)
Attachment 3: include_Zin_block_2.jpg (used attachthumb=3)
Attachment 4: include_Zin_effects.jpg (normal SMF attachment)
Attachment 5: TMC_block.png (used attachmini=5)

You can see the file names are in sorted order.  I did this to keep track of which was which.  I then posted the message and came back to modify it.  I've attached an image that shows the results I got.  Note that TMC_block.png is shown as attachment 4 (should be 5) and include_Zin_effects.png is shown as attachment 5 (should be 4).

I've had stranger results, especially in IE8, that I can't repeat now.  One time the files actually showed up in reverse sort order, not just with two swapped files.

engr_dood

Oh ye of little faith  ;D.

I just tried it, and so far it's looking good.  The attachment numbers and file names now match up when doing the post modify in my preliminary tests with Firefox 3.6.  And the first combo box strings and tags match too.  I'll do some much more thorough testing with IE8 and Firefox tomorrow and report back.

Thanks again!

engr_dood

#107
Okay, I've done some more checking of this.  I wanted to disassociate the file name sort order from the order the attachments were added, so I made up 6 files as follows:

Attachment 1: d_01.png
Attachment 2: a_02.jpg
Attachment 3: g_03.jpg
Attachment 4: b_04.jpg
Attachment 5: f_05.png
Attachment 6: c_06.jpg

So the numbers at the end of the file name match up with the attachment number (order), though the file name sorting is random.

Then I posted the following in Firefox 3.6:

Some text.
[attach=1]
Some text.
[attachimg=2]
Some text.
[attachthumb=3]
Some text.
[attachurl=4]
Some text.
[attachmini=6]

Where attachment 5 (f_05.png) was of the "Normal SMF attachment" type, and the attachment types of 1-4 and 6 are as determined by the codes above.  I posted it, and all the attachments were of the correct type and in the correct location - that is, d_01.png was really attachment 1, a_02.jpg was really attachment 2, and so on.

Then I chose the option to modify the post, and unfortunately, the name/post number associations were all scrambled.  For Firefox 3.6, they looked as in the attachment below named attach_scrambled_FF36.png.  Then I looked at the same post in IE8 by choosing the modify option, and they had the identical scrambling.

So I then posted the exact same thing with IE8, going through the same procedure.  The results were that the file name/post number associations were scrambled, but in a different way.  That result is shown in the attachment below named attach_scrambled_IE8.png.  Then I looked at that post using Firefox 3.6 using the modify option and the scrambling was identical to what it looked like in IE8.

Not sure what to make of this.

engr_dood

#108
Quote from: Spuds on February 22, 2010, 07:17:52 PM
I have a couple of questions that I hope will get me going in the right direction.

1) Once you submit the post and go back and view it, are the attachments in the correct order or are they wrong from the get go

When viewing the post itself, it's perfect.  All attachments are the ones I intended, verified by right-clicking on them as if I were to download them, and viewing the file names.  The next step is to click the "Modify" button, then "Additional Options".  Then the list is found to be scrambled the very first time I look at it.  But in all cases, the post is exactly as it should be - all files in the correct order, all posting options (thumbnail, full size etc.) correct, and so forth.  So it is only the list, not the post itself, that is scrambled, and it is this way the first time I look at it.  Edit: I usually do some previewing before pressing Save though.

Quote from: Spuds on February 22, 2010, 07:17:52 PM2) I'm assuming your test is with a new message and new attachments ... Could you go into phpmyadmin (or whatever database front end you use)  open your smf database and then find the ????_attachments table.  Once there sort on the id_attach column .... are the attachments (the latest uploaded ones will have the highest id_attach numbers) in order of how you first submitted them.  ie attachment 1 should have the lowest id_attach number and so on .... (the sort in the above post that I was referring to was one the id_attach not the name)

Here's a portion of the table.  First col is id_attach, second col is id_thumb.  I've removed the columns in between id_thumb and the file name.  id_msg is the same for all of these (it's 317).

377 378 d_01.png    
378 0 d_01.png_thumb
379 380 a_02.jpg
380 0 a_02.jpg_thumb
381 382 g_03.jpg
382 0 g_03.jpg_thumb
383 384 b_04.jpg
384 0 b_04.jpg_thumb
385 386 f_05.png
386 0f_05.png_thumb
387 388 c_06.jpg
388    0 c_06.jpg_thumb

This is indeed the order in which they were added to the list.

Edit:  Here's the capture from phpMyAdmin (glad I installed this thing!)

engr_dood

This is getting closer, but still not quite there.  The bad news is that there's still an out-of-order condition, but the good news is that I get the same results every time I post the same thing, both with Firefox 3.6 and IE8.  So the behavior seems to be deterministic now.  Here's the post (same as previous):

Some text.
[attach=1]
Some text.
[attachimg=2]
Some text.
[attachthumb=3]
Some text.
[attachurl=4]
Some text.
[attachmini=6]

The capture of the attachment list is below.  The last file posted appears first, and the rest are in order, every time.  Checking the attachments table in phpMyAdmin shows the files to be in the correct order, with attachment ID order agreeing with the order the files were added to the list.

111111

#110
Spuds, help me please with one bug. Often in logs i find such errors. Every time, as somebody visited Print page.

URL: http://********/action=printpage
8: Undefined index: topic_first_message
File: Sources/ILA-Subs.php
String: 203

Also sometimes when somebody reply in topic i find this error again, but i cannot exactly say in what moment this error appeared.
But error always the same on string 203.

Now i find the same but url action another: action=post;msg=111;f4a27b5975cb=acb891bc15d7687a0d76a965c333b2b8

8: Undefined index: topic_first_message
File: Sources/ILA-Subs.php
String: 203

engr_dood

Oh, I didn't think to look in the error log - good idea.  I did a bunch of testing (starting today 2/23) of Alpha 10, and there are no errors dated 2/23 despite there being several posts with multiple attachments that show the sorting quirk.  But with Alpha 9, I got quite a few of these errors showing up:

8: Undefined index: thumbnail
File: C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/Sources/ILA-Subs.php
Line: 267

111111

engr_dood, this error i also had and i fixed it. it appeares only when not an image in attach.
on string 267 need this:

if ($attachment['is_image'])
{


hope it helps you:

if ($attachment['is_image'])
{
if ($attachment['thumbnail']['has_thumb'])
{
// If the image is too large to show inline, make it a popup window.
if (((!empty($modSettings['max_image_width']) && $attachment['real_width'] > $modSettings['max_image_width']) || (!empty($modSettings['max_image_height']) && $attachment['real_height'] > $modSettings['max_image_height'])))
$attachment['thumbnail']['javascript'] = $attachment['thumbnail']['javascript'];
else
$attachment['thumbnail']['javascript'] = 'return ILAexpandThumb(' . $uniqueID . ');';
}
}

111111

#113
Thanks a lot, Spuds! Now logs are empty. But i find one strange bug. Strange, because not only this mod with such bug.
When in somebody's profile i click Show posts, for example such url in your profile http://www.simplemachines.org/community/index.php?action=profile;area=showposts;u=11359
And on this page with posts of user this mod doesn't work =( Show only tags. And what is interesting that another mod "Hide Tag Special" has almost the same bag.

UPDATE: Now I find in logs one error. I can repeat it every time i clicked show posts in profile.

http://*******/index.php?pretty;action=profile&area=showposts;u=2
8: Undefined index: current_topic
File: /var/www/alexsus/data/www/game-edition.ru/Sources/ILA-Subs.php
String: 206

engr_dood

#114
Quote from: Spuds on February 23, 2010, 08:39:59 PM
This version should fix both of these, but there may be others so keep looking in the logs.   These are nothing more than notice errors.

This is looking great now.  The file ordering display worked perfectly in all my tests.  Case closed on this aspect I think.  Congratulations and thanks for your perseverance!  It's looking like our forum will be able to upgrade to 2.0 RC2 soon, thanks to your efforts with this mod.

There's a couple of things I had in mind regarding usability.  You've stated previously that graphical preview is a non-trivial problem and more of a long-term thing, if at all.  That's cool, but maybe there's some things that could be done to improve the user experience in this area without causing you a boatload of effort?  I was thinking of something along these lines in preview:

Text.  More text.  Text.  More text.  Text.  More text.  Text.  More text.  Text.  More text. 
[Attachment 1: file_01.png as expandable thumbnail]
Text.  More text.  Text.  More text.  Text.  More text.  Text.  More text.  Text.  More text.
[Attachment 2: file_02.jpg as full-size graphic]
Text.  More text.  Text.  More text.  Text.  More text.  Text.  More text.  Text.  More text. 
[Attachment 3 not found.  There are only 2 attachments.]

Would this be time-consuming to implement?  This would at least tell the user that the right files are in the right places (or not), and what their display mode is without having to post the message.  Regarding the nature of the error message about attachment 3, it comes from a book on UI guidelines for developers I read a while back.  I used to work on Windows GUI programming for engineering desktop apps for a few years.  One of the guidelines was along the lines of what I call "politically correct error messages".  The guideline is to not scold the user with words like "error" or "warning", but to simply provide helpful information regarding the nature of the problem and how to fix it if possible.  Anyway, I can't think of the word "warning" without thinking about the robot in Lost In Space flailing his arms and saying "Danger!  Warning!"  ;D.

My other concern was about [attach=] vs. [attachthumb=].  I could be misunderstanding this, but apparently the distinction between the two is related to how the internal error of a missing thumbnail is handled.  Looking at the normal SMF attachment scenario, there is no such option.  I guess the software just figures out the best way to handle it and does so without the user's knowledge.  This is the way it should be I think.  It seems to me that having this distinction between [attach=] and [attachthumb=] violates another UI guideline, namely, "don't burden the users with implementation details of the software".  In this case, that's the handling of the missing thumbnail condition.  So I would propose to have the following choices in the combo box:

End-of-post expandable thumbnail
Inline expandable thumbnail
Inline full-size image
Inline text link
Inline short text link

I've replaced "Normal SMF attachment" with "End-of-post expandable thumbnail", since many users may not know what a normal SMF attachment is.  I'd propose that "Inline expandable thumbnail" become [attach=].  I'd also propose that [attachthumb=] be deprecated, but accepted if typed in manually by the user ("be liberal in what you accept and conservative in what you provide").  That is, remove combo-box support for this tag to avoid confusing the users with the implementation issue of how a missing thumbnail should be handled.

That's all of the concerns I have, which I hope aren't burdensome.



engr_dood


engr_dood

Quote from: Spuds on February 28, 2010, 11:25:03 PM
OK here is another version for testing, still have work to do but this is a good step in the final direction.

This is working really well.  I can't find any bugs in it.

Having the graphics display in places like recent post view and others really gives a nice professional appearance.  The mod I'm using now for 1.1.11 doesn't do that.

gbsothere

Quote from: slinouille on January 24, 2009, 02:00:55 AM
Hello,

Sorry I've not enough time to manage a SMF1.x version.
But if someone wants to do it, he/she is welcome  :)

SliN




I wasn't sure whether to ask this here or to post this on the "Paid" board, but I am very interested in paying someone to backport this to 1.1.X  (our board is 1.1.11). 

We were using the TinyPics option (found in Tips And Tricks) but this morning, someone apparently hacked TinyPic's site and every image in our forum hosted by TinyPics had become Porn images.  *sigh*  A mess, let me tell you! At least, with attachments, not hosted links, I have some measure of control, since our forum is heavily guarded against spammers and hackers.

If this is not the appropriate place to request a paid backport, please point me in the right direction.

:-\
My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

engr_dood

Quote from: gbsothere on March 02, 2010, 11:31:42 AM
I wasn't sure whether to ask this here or to post this on the "Paid" board, but I am very interested in paying someone to backport this to 1.1.X  (our board is 1.1.11).

Hi gbsothere,
I'm using 1.1.11 at the moment as well.  The multiple attachment mod for it that I'm using is the quake101 mod, "ATTACHMENTS POSITIONING v1.2".  Spuds has written his mod for version 2 so it will accept the [attachment=] custom tags of the quake101 mod (different from the [attach=] custom tags used by the original Slinouille mod that started this thread, and subsequently used by Spuds).  So you could start with 1.1.11 and the quake101 mod, and when you're ready to upgrade to SMF 2, the Spuds mod will get you there with your graphics preserved.  I"ve tested this and it works great.  Hats off to Spuds for this backward compatibility feature.

At present there is no graphical WYSIWYG preview for either of these mods, but I compensate for that by having a longer editing period than what might otherwise be needed.

gbsothere

Quote from: engr_dood on March 02, 2010, 12:05:22 PM
Hi gbsothere,
I'm using 1.1.11 at the moment as well.  The multiple attachment mod for it that I'm using is the quake101 mod, "ATTACHMENTS POSITIONING v1.2".  Spuds has written his mod for version 2 so it will accept the [attachment=] custom tags of the quake101 mod (different from the [attach=] custom tags used by the original Slinouille mod that started this thread, and subsequently used by Spuds).  So you could start with 1.1.11 and the quake101 mod, and when you're ready to upgrade to SMF 2, the Spuds mod will get you there with your graphics preserved.  I"ve tested this and it works great.  Hats off to Spuds for this backward compatibility feature.

At present there is no graphical WYSIWYG preview for either of these mods, but I compensate for that by having a longer editing period than what might otherwise be needed.




Thanks so much, engr_dood, for bringing this to my attention.  We're in a bit of a precarious place, as far as upgrading to 2.x just now, but I do have 2.x test boards, so I'll play around with this and see if I can make it fly.   :)

Thanks, again!
My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

Advertisement: