When a member includes a non-image file attachment to a email they send to my forum for posting, the icon for the attachment (a paperclip) isn't showing properly.
Pedro made changes to my forum so that the image attachments show a smaller thumbnail of the image - which I still want. (Reference this topic:
http://support.nabble.com/Possible-to-display-JPG-attachment-in-email-tp7589178.html) I just have members complaining on other attachments (Word Documents, PDF, etc.) the attachment icon shows as a broken link (so they think they're missing something).
The HTML coding in the email for the attachments looks like this:
<div id ="attachments">
<!--start-attachments--><div class="small"><br/><img src= "http://forum.sudsol.org/attachment/17006/0/Blendabilities%20Color%20Chart.pdf" height="250px" >
<strong>Blendabilities Color Chart.pdf</strong> (128K) <a href="http://forum.sudsol.org/attachment/17006/0/Blendabilities%20Color%20Chart.pdf" target="_top"
rel="nofollow" link="external">Download Attachment</a></div><!--end-attachments-->
</div>
So you can see it's trying to display the PDF file as an image file (which doesn't work). And looks like this in the email:
Is there a way to update the code for the creation of the icons that uses the standard paperclip if the file is not an image type (JPG, JPEG, PNG, TIF, GIF)?
I think it's in my "message_as_html" override where it states...
<n.regex. text="[n.var name='attachments'/]" pattern="[n.href_regex/]">
<n.loop.>
<n.set_var. name="thumb_url">
src= <n.regex_replace_all text ="[n.current_element/]" pattern="href=" replacement =''/> height="250px" \>
</n.set_var.>
<n.set_var. name="attachments">
<n.regex_replace_first text ="[n.var name='attachments'/]" pattern="[n.img_regex/]" replacement ="[n.var name='thumb_url'/]"/>
</n.set_var.>
</n.loop.>
</n.regex.>
<macro name="img_regex">
<![CDATA[src=.*?\>]]>
</macro>
I think I just need an IF check in there to only change the thumb_url if the attachment is one of the image file types. (Or perhaps the img_regex macro Pedro created needs to be changed to only look for the .JPG, .PNG, etc.)
Suggestions?
Thanks,
Coleen