News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Post and PM Inline Attachments

Started by dougiefresh, July 26, 2014, 09:14:08 PM

Previous topic - Next topic

dougiefresh

Quote from: Motorhed on April 29, 2015, 06:48:45 PM
This just flat-out doesn't work for me.

Installed fine, but every file I attach gives the "Invalid" text in the post no matter what I do.

:(

On preview, it works. After posting the edit, it doesn't.
WTF!!  Have you tried uninstalling the mod completely from your forum yet?  Might wanna try reinstalling once you uninstall the mod....  This makes absolutely no sense to me....

dougiefresh

#161
Quote from: Motorhed on April 29, 2015, 06:48:45 PM
RETRACTED COMPLAINT. Turning on "make sure attachment is 1" thing in settings fixes this!
Wow!  Good to know what was causing the issue!  Thanks for the feedback....

Attached is an updated version of the previously attached file that corrects the undefined variable errors you reported....  Use it if you want...

EDIT:  VERY IMPORTANT: Remember, if the "first attachment is number 1" option is set, the minimum value for attachment ID is ONE (1).  Numbers below that will error out.  When it is unchecked, the minimum value for attachment ID is ZERO (0).

RSI

#162
Don't let it get you down ;)

I already fixed it and here is what happened. I renamed my Subs-InlineAttachments.php file that was working to Subs-InlineAttachments_(Working).php Then I overwrote the one on my server with the one you uploaded earlier today. I then went to a few posts and clicked on [attach=n] and [attachment=n] pics and everything was working, but when I checked the log I saw all of the Undefined variable: use_thumbnail errors. So, I then I reported it and re-uploaded the working file from before. After doing that the [attach=n] pics would no longer expand like what I saw on my test board the other day.

Now, I went through and removed all hooks and ran the SMF v2.010 upgrade package again on my board and re-installed this Post and PM Inline Attachments v3.1.2 mod with the known working Subs-InlineAttachments file. However, the [attach=n] pics would still not expand.

Here's what I had to do to get it working again, I manually went into my database into the smf_settings table and selected and dropped everything that said ila It's looks like there was also stuff there from the old ILA mod too (spuds mod). That's one of the problems when you uninstall 90% of these mods because it normally doesn't remove all of the tables and entries it created during install.

Anyway, after manually dropping all of that leftover junk I performed the SMF v.2.0.10 upgrade again to make sure and re-installed the Post and PM Inline Attachments v3.1.2 and now the [attach=n] pics are expanding again.

There must be some conflict with either the old leftover ILA mod table entries or with the ones your mod is creating. On my test board I had installed and uninstalled the old ILA mod and your mod several times. Now it happened on my actual live board today just by uploading the new Subs-InlineAttachments.php file then overwriting it with the old one that was working.

Update: The more I think about it the more I think it is the leftover tables from the old ILA mod (spuds mod). That might explain why the problem went away when I deleted my test board's database and then re-created it. It might also explain why I was having the weird problem with the Highslide on and off checkbox that you eventually removed. Depending on where people leave those checkboxes set when they uninstall the old ILA mod might determine the settings when they install your mod. As a matter of fact I think I do remember unchecking the checkbox to turn that mod off before I uninstalled it. That might actually explain why when I installed your mod last week the Highslide wouldn't work until I played around with the checkbox that was automatically checked during install.

You might need to make it search for the old ILA mod table entries and delete them first before it installs.
.

RSI

Quote from: RSI on April 29, 2015, 08:37:32 PM
Don't let it get you down ;)

I already fixed it and here is what happened. I renamed my Subs-InlineAttachments.php file that was working to Subs-InlineAttachments_(Working).php Then I overwrote the one on my server with the one you uploaded earlier today. I then went to a few posts and clicked on [attach=n] and [attachment=n] pics and everything was working, but when I checked the log I saw all of the Undefined variable: use_thumbnail errors. So, I then I reported it and re-uploaded the working file from before. After doing that the [attach=n] pics would no longer expand like what I saw on my test board the other day.

Now, I went through and removed all hooks and ran the SMF v2.010 upgrade package again on my board and re-installed this Post and PM Inline Attachments v3.1.2 mod with the known working Subs-InlineAttachments file. However, the [attach=n] pics would still not expand.

Here's what I had to do to get it working again, I manually went into my database into the smf_settings table and selected and dropped everything that said ila It's looks like there was also stuff there from the old ILA mod too (spuds mod). That's one of the problems when you uninstall 90% of these mods because it normally doesn't remove all of the tables and entries it created during install.

Anyway, after manually dropping all of that leftover junk I performed the SMF v.2.0.10 upgrade again to make sure and re-installed the Post and PM Inline Attachments v3.1.2 and now the [attach=n] pics are expanding again.

There must be some conflict with either the old leftover ILA mod table entries or with the ones your mod is creating. On my test board I had installed and uninstalled the old ILA mod and your mod several times. Now it happened on my actual live board today just by uploading the new Subs-InlineAttachments.php file then overwriting it with the old one that was working.

Update: The more I think about it the more I think it is the leftover tables from the old ILA mod (spuds mod). That might explain why the problem went away when I deleted my test board's database and then re-created it. It might also explain why I was having the weird problem with the Highslide on and off checkbox that you eventually removed. Depending on where people leave those checkboxes set when they uninstall the old ILA mod might determine the settings when they install your mod. As a matter of fact I think I do remember unchecking the checkbox to turn that mod off before I uninstalled it. That might actually explain why when I installed your mod last week the Highslide wouldn't work until I played around with that checkbox that was checked during install.

You might need to make it search for the old ILA mod table entries and delete them first before it installs.
.

RSI

When I have the chance this coming weekend I'll install another test board and play around again and see if I can help you figure out what's going on for certain. I don't want to take the risk of having to redo my board again. Twice is enough. I'm using the Remove images from quotes v1.6 mod so I have the quotes feature disabled. I don't really need or care if that works on my board anyway.

I'm not sure what timezone you are on, but I'm an engineer here in Silicon Valley California. I have a hunch it's one or more of the old ILA mod tables causing a conflict and things (or something) is working against each other in the smf_settings table

dougiefresh

YET ANOTHER UPDATE: For the next version, I've changed the mod settings php file so that the settings are set to mod defaults, regardless of previous settings.  I've also gotten the "Insert Attachment" thingy to work on SMF 2.1, but haven't figured out SMF 2.0 with the SCEditor mod installed yet (still working on this one, though...)




@RSI:  I looked at both Highslide mods, and they don't share any settings.  So there is absolutely no possibility that a SETTING can be causing the conflict (at least, as far as I can tell).  It's possible that it could be a conflict in the code, but once again, I can't imagine how it would conflict.

Quote from: RSI on April 30, 2015, 02:17:56 PM
I'm not sure what timezone you are on, but I'm an engineer here in Silicon Valley California.
I am a automotive railcars loader in Tennesse.  I do programming as a hobby....

RSI

Quote from: dougiefresh on May 01, 2015, 08:54:30 PM
@RSI:  I looked at both Highslide mods, and they don't share any settings.  So there is absolutely no possibility that a SETTING can be causing the conflict (at least, as far as I can tell).  It's possible that it could be a conflict in the code, but once again, I can't imagine how it would conflict.

Actually, I was talking about the old ILA In-Line attachment mod and not the ILA Highslide mod. The old ILA In-Line attachment mod settings are still left in the smf_settings table after you uninstall it. That's what got me to thinking and thought it was worth looking into because it sort of made a little sense. It still could be just something weird in the Subs-InlineAttachments.php file code, but whatever it is it was defiantly real because it happened again on my actual board and not just on my test board. It happened both times even after uninstalling the Highslide mod.

Hope that helps...

dougiefresh

#167
UPDATE: Mod now works with SMF 2.0 with SCEditor mod installed!  Yay!  One clearly definable problem remains: Previewing posts with inline attachments doesn't work for that message, but works for quoted images....  Still looking into the issue that RSI brought up...




@RSI: I'm sorry.  I kinda misspoke.  I meant to say that I also looked at Spud's SMF-ILA mod, which doesn't share any settings with this mod, either.  This is the mod you are talking about, right?

roshaoar

#168
Hello Dougie,

First of all let me commend you, this mod is exactly what I'm looking for and thus far it has worked almost perfectly with 2.0.10 and highSlide. Images are the most important thing to me - I have a macro photography site and people ask me all sorts of questions using the form, so adding a forum makes sense. And because it will be primarily photography orientated, I have to have the best options with images that there are - these guys like posting photos :)

May I ask you a couple of questions. Does adding this resize images in some way even if you have maximum image width and height set to 10,000px in the admin option? The reason I ask is because I want to show EXIF for every image posted and I already fixed fatman's exif mod to make it work and work better on 2.0.10. If you look at http://extreme-macro.co.uk/forums/index.php?topic=10.0 you'll see it does fine with image as thumb and shows the stuff but I'd like the same with inline images. I'm not sure how to do it but it didn't by default on that thread so either it's been stripped or it's not being inserted. before I look to fix the latter can I just confirm it's not the former please?

Great work, thanks again,

-Johan

RSI

Quote from: dougiefresh on May 02, 2015, 08:06:48 AM
@RSI: I'm sorry.  I kinda misspoke.  I meant to say that I also looked at Spud's SMF-ILA mod, which doesn't share any settings with this mod, either.  This is the mod you are talking about, right?

Yeah, that's the one. Then it must have been something with your settings in the smf_settings table. The only way I could get the problem to go away was select everything that said ILA and drop them then reinstall the mod. It was still weird though that just trying that other Subs-InlineAttachments.php file that produced those errors in the log  and then putting the one back before it made it happen again. I'm trying to remember if I changed the settings under Modifications => Settings => ILA after uploading the new file before putting the other one back, I may have.

dougiefresh

Uploaded v3.2 - April 29th, 2015
o Modified inserting attachment javascript code so that it works with SMF 2.1 Beta 1....
o Modified inserting attachment javascript code so that it works with SMF 2.0 with SCEditor mod installed.
o Fixed bug relating to referring to inline attachments from another message.
o All settings reset to their default settings upon installation or upgrade.

dougiefresh

#171
Quote from: roshaoar on May 02, 2015, 10:29:10 AM
May I ask you a couple of questions. Does adding this resize images in some way even if you have maximum image width and height set to 10,000px in the admin option? The reason I ask is because I want to show EXIF for every image posted and I already fixed fatman's exif mod to make it work and work better on 2.0.10. If you look at http://extreme-macro.co.uk/forums/index.php?topic=10.0 you'll see it does fine with image as thumb and shows the stuff but I'd like the same with inline images. I'm not sure how to do it but it didn't by default on that thread so either it's been stripped or it's not being inserted. before I look to fix the latter can I just confirm it's not the former please?
This makes NO changes to the attachment handling code, and a few minor changes to the attachment display code so that the bbcode parser can get the attachments in the parse_bbc function.  However, the default setting for this mod is to hide the images used inline from being displayed again as an attachment thumbnail.  Unchecking this box will enable the EXIF information to be displayed by Display.template.php without further modification, but I have a feeling that's not what you're wanting (or asking for).

I'll add some code to the next version so that the EXIF information to the Subs-InlineAttachments.php file so that it is displayed along with the inline attachment, just like it would be if it was shown as an attachment (but not shown inline).

dougiefresh

Uploaded v3.3 - May 2nd, 2015
o Added checkbox to enable the display of EXIF information (when available) to ILA settings.
o Modified Subs-InlineAttachments.php to display EXIF information when option is enabled.
o Modified code to optimize memory usage within Sources/Display.php.

roshaoar

#173
Wow. You are truly phenomenal. I'd buy you a beer if you were near!!!

I've installed the update and tested it out at the same thread but sadly no exif showing :(. Probably because the checkbox wasn't there to tick - screenshot attached. I take it this where the checkbox should be?

[post edit - yes that's it. When I edited the file to read "if (empty($modSettings['ila_display_exif']) && etc" it shows exif! Wow!!]

dougiefresh

The mod checks for the presence of the Sources/exif.php before showing that option.  Do you have that file?

roshaoar

Yeah I do - it's something to do with the check. When I edit the file to read "if (empty($modSettings['ila_display_exif']) && isset($attachment['exif']))" it works fine

dougiefresh

Uploaded v3.3.1 - May 2nd, 2015
o Fixed code that shows the Highslide and EXIF option in the ILA settings.

@roshaoar: Damn, I'm sorry I completely missed that one!  With this update, both the Highslide and EXIF options should be visible on the ILA settings page now.  Seems that I messed up on adding the options to the $config array instead of the $config_vars array....  DOH!

roshaoar

Hehe, you're a star for doing it in the first place, let me upload it and check it out :)

roshaoar

That is really really really cool, thank you so much. In time, thousands of wannabe macro gods will learn thank to you :) I think you've added something to make the font size bigger, and it looks like there's a missing br that needs to be dealt with to make the two versions compatible. But that's just incidental - this is fabulous. I can't thank you enough :)

[update - font size thing is only if "Show download link and counter under inline attachment?" unchecked - style must in that things' class]

dougiefresh

@roshaoar: Find this line in Sources/Subs-InlineAttachments.php:
Code (Find) Select
$html .= $attachment['exif'] . '<br /><br />';
and replace it with this:
Code (Replace) Select
$html .= '<br /><span class="smalltext">' . $attachment['exif'] . '</span><br /><br />';
Does this make it look proper?  Thanks in advance!

Advertisement: