Advertisement:

Author Topic: Post and PM Inline Attachments  (Read 153757 times)

Offline RSI

  • Jr. Member
  • **
  • Posts: 123
Re: Post and PM Inline Attachments
« Reply #40 on: December 27, 2014, 01:27:07 PM »
Hello,

I'm using SMF 2.0.7 and I installed your pervious version 2.1 a couple of weeks ago and I'm getting the error in the error log below.

I've had Highslide installed since last spring and when I place images inline with your mod the inline images work fine with Highslide.

I don't know why I'm getting the errors though? I saw it again yesterday and it said line 469. This time it's line 470.

It looks like its happening each time I insert an image inline. It generates the error even though the images are inline and Highslide works with them fine.

I want to correct this… How?  Is there a "Subject" line missing in the Modifications.english.php file or something?

mydomain.com/index.php?action=post2;start=25;board=8

8: Undefined index: subject

File: /home/me/public_html/Sources/Subs-InlineAttachments.php
Line: 470
« Last Edit: December 27, 2014, 02:04:54 PM by RSI »

Offline RSI

  • Jr. Member
  • **
  • Posts: 123
Re: Post and PM Inline Attachments
« Reply #41 on: December 27, 2014, 04:23:28 PM »
Strange..., I took the latest Subs-InlineAttachments.php file from your v2.2 and overwrote the one I was using from v2.1 and it fixed the problem.

Looks like you added some to that file just recently ???

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,423
    • XPtsp.com Community
Re: Post and PM Inline Attachments
« Reply #42 on: December 27, 2014, 07:04:51 PM »
Strange..., I took the latest Subs-InlineAttachments.php file from your v2.2 and overwrote the one I was using from v2.1 and it fixed the problem.

Looks like you added some to that file just recently ???
Yeah, I fixed something about the mod and, off the top of my head, I can't remember what I exactly fixed.  I remember something about undeclared variables or something-or-other and what you listed sounds like it was one of the issues I found with the mod during a live test on my own website....
NOTICE:  My website is back up!

My Free Simple Machines mods on XPtsp.com and Simple Machines Customization Site!
My mods are being uploaded and are available at GitHub as well!

Offline RSI

  • Jr. Member
  • **
  • Posts: 123
Re: Post and PM Inline Attachments
« Reply #43 on: December 28, 2014, 10:11:01 AM »
Is there anyway to remove the space between the inline image and the download link and counter?

Normally it's right underneath the image, but its adding a space for some reason.

Other than that everything works fine now.

See an example of what I'm getting attached below...

 
« Last Edit: December 28, 2014, 10:24:34 AM by RSI »

Offline RSI

  • Jr. Member
  • **
  • Posts: 123
Re: Post and PM Inline Attachments
« Reply #44 on: December 28, 2014, 12:28:51 PM »
I found it…

Don't know if it was an intentional personal preference thing or just a carryover that was missed but there is a <br /> and a <br/> in the Subs-InlineAttachments.php code below.

Removing the one last <br/> solves it and the links are displayed right under images now. I removed both of them.

Find
Code: [Select]
// Highslide Image Viewer Installed?
elseif (function_exists('highslide_images'))
$html = '<a href="' . $image . ';image" id="link_' . $id . '" class="highslide" rel="highslide"><img src="' . $thumb . '" ' . $width . $height . ' alt="' . $attachment['name'] . '"' . $float . $margin . ' id="thumb_' . $id . '" /></a><br /><span class="highslide-heading">' . $context['subject'] . '</span>';
// jQLightbox
elseif (!empty($modSettings['enable_jqlightbox_mod']) && strpos($context['html_headers'], 'jquery.prettyPhoto.css'))
$html = '<a href="' . $image . ';image" id="link_' . $id . '" rel="lightbox[gallery]"><img src="' . $thumb . '" ' . $width . $height . ' alt="' . $attachment['name'] . '"' . $float . $margin . ' id="thumb_' . $id . '" /></a>';
// Simple Mode
else
$html = '<img src="' . $thumb . ';image" alt=""' . $width . $height . ' alt="' . $attachment['name'] . '"' . $float . $margin . ' class="bbc_img resized" />';
}
else
$html = '<img src="' . $thumb . ';image" alt=""' . $width . $height . ' alt="' . $attachment['name'] . '"' . $float . $margin . ' class="bbc_img resized" />';

// Add the download count to the image tag if requested:
if (!empty($modSettings['ila_download_count']) && $tag['tag'] != 'attachmini')
$html .= '<br/><div class="smalltext"><a href="' . $image . '"><img src="' . $settings['images_url'] . '/icons/clip.gif" align="middle" alt="*" border="0" />&nbsp;' . $attachment['name'] . '</a> ('. $attachment['size']. ($attachment['is_image'] ? '. ' . $src_width . 'x' . $src_height . ' - ' . $txt['attach_viewed'] : ' - ' . $txt['attach_downloaded']) . ' ' . $attachment['downloads'] . ' ' . $txt['attach_times'] . '.)</div>';

Replace with
Code: [Select]
// Highslide Image Viewer Installed?
elseif (function_exists('highslide_images'))
$html = '<a href="' . $image . ';image" id="link_' . $id . '" class="highslide" rel="highslide"><img src="' . $thumb . '" ' . $width . $height . ' alt="' . $attachment['name'] . '"' . $float . $margin . ' id="thumb_' . $id . '" /></a><span class="highslide-heading">' . $context['subject'] . '</span>';
// jQLightbox
elseif (!empty($modSettings['enable_jqlightbox_mod']) && strpos($context['html_headers'], 'jquery.prettyPhoto.css'))
$html = '<a href="' . $image . ';image" id="link_' . $id . '" rel="lightbox[gallery]"><img src="' . $thumb . '" ' . $width . $height . ' alt="' . $attachment['name'] . '"' . $float . $margin . ' id="thumb_' . $id . '" /></a>';
// Simple Mode
else
$html = '<img src="' . $thumb . ';image" alt=""' . $width . $height . ' alt="' . $attachment['name'] . '"' . $float . $margin . ' class="bbc_img resized" />';
}
else
$html = '<img src="' . $thumb . ';image" alt=""' . $width . $height . ' alt="' . $attachment['name'] . '"' . $float . $margin . ' class="bbc_img resized" />';

// Add the download count to the image tag if requested:
if (!empty($modSettings['ila_download_count']) && $tag['tag'] != 'attachmini')
$html .= '<div class="smalltext"><a href="' . $image . '"><img src="' . $settings['images_url'] . '/icons/clip.gif" align="middle" alt="*" border="0" />&nbsp;' . $attachment['name'] . '</a> ('. $attachment['size']. ($attachment['is_image'] ? '. ' . $src_width . 'x' . $src_height . ' - ' . $txt['attach_viewed'] : ' - ' . $txt['attach_downloaded']) . ' ' . $attachment['downloads'] . ' ' . $txt['attach_times'] . '.)</div>';

// Clear the parameter set for the next usage and return string to caller:
unset($context["ila_params"]);
return $html;
}

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,423
    • XPtsp.com Community
Re: Post and PM Inline Attachments
« Reply #45 on: December 28, 2014, 06:58:50 PM »
Uploaded v2.3 - December 28th, 2014
o Performance enhancement due to storing permission check after first check.
o Fixed spacing issues between picture and download counter/link.  Thanks, RSI!
NOTICE:  My website is back up!

My Free Simple Machines mods on XPtsp.com and Simple Machines Customization Site!
My mods are being uploaded and are available at GitHub as well!

Offline RSI

  • Jr. Member
  • **
  • Posts: 123
Re: Post and PM Inline Attachments
« Reply #46 on: December 28, 2014, 07:14:45 PM »
Hey, thank you very much for creating and updating this mod. I've been waiting for someone to finally do it!!!

I tied using the HS4 and ILA mods a while back, but I already had the Highslide mod installed and modified at the time and there were conflicts trying to add them after.

Anyway, this should be a standard feature built-into SMF period!!! I cannot really say anything more other than this one looks like it belongs with it.

Again, thanks…!!!





Offline tranhiep_116

  • Jr. Member
  • **
  • Posts: 100
Re: Post and PM Inline Attachments
« Reply #47 on: December 28, 2014, 07:30:44 PM »
 thanks you very much for creating and updating this mod. I will using it for my smf ;D

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,423
    • XPtsp.com Community
Re: Post and PM Inline Attachments
« Reply #48 on: December 28, 2014, 07:32:44 PM »
You're welcome! 

@RSI:  I agree with ya, but I have very serious doubts that SMF will ever incorporate this into the core code....  You never know, though....
NOTICE:  My website is back up!

My Free Simple Machines mods on XPtsp.com and Simple Machines Customization Site!
My mods are being uploaded and are available at GitHub as well!

Offline RSI

  • Jr. Member
  • **
  • Posts: 123
Re: Post and PM Inline Attachments
« Reply #49 on: January 11, 2015, 04:16:40 PM »
Hi,

I wanted to give you an update on this. With version 2.2 installed I was still occasionally getting the errors and it it only happened on uploads where the server traffic or something appeared to be a little high when the uploads were slow. And when it happened it was always with a different line in the Subs-InlineAttachments.php file.

I recently uploaded the new 2.3 version of then Subs-InlineAttachments.php file and now it happens again every single time again, but it's always the same line now, line 523.

The error I get is below. Any idea on how to correct this?

http://mydomain.com/index.php?action=post2;start=25;board=7

8: Undefined index: subject

File: /home/me/public_html/Sources/Subs-InlineAttachments.php

Line: 523

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,423
    • XPtsp.com Community
Re: Post and PM Inline Attachments
« Reply #50 on: January 11, 2015, 05:02:40 PM »
Uploaded v2.4 - January 11th, 2015
o Fixed undefined index error within Subs-InlineAttachments.php...

@RSI: This update should solve the issue you reported.  Thank you for the bug report!
NOTICE:  My website is back up!

My Free Simple Machines mods on XPtsp.com and Simple Machines Customization Site!
My mods are being uploaded and are available at GitHub as well!

Offline RSI

  • Jr. Member
  • **
  • Posts: 123
Re: Post and PM Inline Attachments
« Reply #51 on: January 12, 2015, 10:02:41 AM »
K, that fixed it... Thanks...

Now I can just leave it alone for the next several years 8)


Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,423
    • XPtsp.com Community
Re: Post and PM Inline Attachments
« Reply #52 on: January 19, 2015, 09:42:42 AM »
Uploaded v2.5 - January 19th, 2015
o License change to Simplified BSD.  No functionality change.
NOTICE:  My website is back up!

My Free Simple Machines mods on XPtsp.com and Simple Machines Customization Site!
My mods are being uploaded and are available at GitHub as well!

Offline RSI

  • Jr. Member
  • **
  • Posts: 123
Re: Post and PM Inline Attachments
« Reply #53 on: January 19, 2015, 11:03:39 AM »
Hi, there is a problem with IE or at least with IE11. The images do not display. You can see the placeholders and when you click on them they pop up fine and display if using Highslide, but the in-line images are not displaying within posts themselves.

I never checked it on IE before and all I have is IE11 so I'm not sure if it also effects IE10, 9, etc. but it's definitely a big problem if using IE11. I had a couple of users complain so I just looked at it and can see the problem. I even tried using compatibility mode and it starts to resize the images properly when doing that, but you still only see the placeholders. Everything is fine when using Safari or Firefox, just not with IE11 and possibly earlier.

P.S. I just manually went through and updated to the latest version 2.5 and it’s still the same, wont display the images in-line with IE11. Can only see the placeholders.
« Last Edit: January 19, 2015, 12:28:44 PM by RSI »

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,423
    • XPtsp.com Community
Re: Post and PM Inline Attachments
« Reply #54 on: January 19, 2015, 06:32:31 PM »
Lemme look into this issue...
NOTICE:  My website is back up!

My Free Simple Machines mods on XPtsp.com and Simple Machines Customization Site!
My mods are being uploaded and are available at GitHub as well!

Offline RSI

  • Jr. Member
  • **
  • Posts: 123
Re: Post and PM Inline Attachments
« Reply #55 on: January 19, 2015, 08:18:27 PM »
Update, it's doing the same thing with IE8. Hope that helps...


Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 68,044
    • Arantor on GitHub
Re: Post and PM Inline Attachments
« Reply #56 on: January 19, 2015, 08:34:12 PM »
I haven't dug into the mod... but related question: when you serve attachments, are you serving them through dlattach? More importantly... when you serve the attachment, do you have the correct Content-Type header being sent? IE8+ will choke on a file when there is an incorrect/missing content-type header declaration versus what the file contains. E.g. if you serve it a picture, the Content-Type needs to match the picture otherwise IE will refuse to show the picture. (Even if you tell it the image is a JPEG when the file is really a PNG for example)
To assume is to hope that those who came before had the presence of mind and capacity to implement the dreams of those who would come after.

You either die a hero or live long enough to see yourself become the villain. It seems you have chosen which, and now I must do the same.

Offline RSI

  • Jr. Member
  • **
  • Posts: 123
Re: Post and PM Inline Attachments
« Reply #57 on: January 20, 2015, 10:08:07 AM »
Below is an example of what's being sent to the browser.

Code: [Select]
<a href="http://mydomain.com/index.php?action=dlattach;topic=207.0;attach=1173;image" id="link_0" class="highslide" rel="highslide"><img src="http://mydomain.com/index.php?action=dlattach;topic=207.0;attach=1173" &nbsp;width="300" height="183" alt="RF_Deck_Mod_01.png" id="thumb_0"></a>

<span class="highslide-heading">My Topic</span>

<div class="smalltext"><a href="http://mydomain.com/index.php?action=dlattach;topic=207.0;attach=1173"><img src="http://mydomain.com/Themes/default/images/icons/clip.gif" align="middle" alt="*" border="0">&nbsp;RF_Deck_Mod_01.png</a> (79.38 kB. 300x183 - viewed 352 times.)</div>

I don't have anything earlier than IE8 so I don't know about IE7, but its probably a pretty safe bet to assume it's not working from IE8 on up to IE11. It's doing the exact same thing on IE8 and IE11 both.

I remember all of those different Content-Type headers for IE a while back and some where on the main index page or template, but I think those were all eventually removed, right? I assume you are talking about adding them somewhere else for this mod…?

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 68,044
    • Arantor on GitHub
Re: Post and PM Inline Attachments
« Reply #58 on: January 20, 2015, 10:28:45 AM »
Yes, I'm not talking about anything on the page itself that you're looking at, I'm talking about the physical request/response for actually sending the file.

As a temporary test to prove whether this is the root cause, take a look in the top level index.php file.

You'll see this line:
Code: [Select]
header('X-Content-Type-Options: nosniff');
If you remove that line temporarily and try it again, does it work?
To assume is to hope that those who came before had the presence of mind and capacity to implement the dreams of those who would come after.

You either die a hero or live long enough to see yourself become the villain. It seems you have chosen which, and now I must do the same.

Offline RSI

  • Jr. Member
  • **
  • Posts: 123
Re: Post and PM Inline Attachments
« Reply #59 on: January 20, 2015, 10:55:30 AM »
Yes, I'm not talking about anything on the page itself that you're looking at, I'm talking about the physical request/response for actually sending the file.

As a temporary test to prove whether this is the root cause, take a look in the top level index.php file.

You'll see this line:
Code: [Select]
header('X-Content-Type-Options: nosniff');
If you remove that line temporarily and try it again, does it work?

Yep, it's works if I comment out that line ;)