Possible to display JPG attachment in email

classic Classic list List threaded Threaded
26 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Re: Possible to display JPG attachment in email

Pedro
This post was updated on .
Just to let you know: I lost some of your configurations on my test forum. So, I am setting up a new forum only to reproduce and to fix your issues.
My test forum.
Reply | Threaded
Open this post in threaded view
|

RE: Possible to display JPG attachment in email

Coleen_Astalos

Ok, let me know if you need anything from me.

Thanks!

Coleen

 

Coleen Astalos, Stampin' Up! Demonstrator
Alamosa, CO, [hidden email]
See my website at http://alamosa.stampinup.net
Are you a demonstrator? Join me on SUDSOL - Your 24/7 Upline!

 

From: Pedro <Nabble> [via Nabble Support] [mailto:[hidden email]]
Sent: Thursday, May 29, 2014 8:38 PM
To: Coleen_Astalos
Subject: Re: Possible to display JPG attachment in email

 

Just to let you know: I lost some of your configurations on my test forum. So, I am setting up a new forum only to reproduce and to xi your issues.

My test forum.

 


If you reply to this email, your message will be added to the discussion below:

http://support.nabble.com/Possible-to-display-JPG-attachment-in-email-tp7589178p7590388.html

To unsubscribe from Possible to display JPG attachment in email, click here.
NAML

Reply | Threaded
Open this post in threaded view
|

RE: Possible to display JPG attachment in email

Pedro
Please, try this code. Note that, at line 56 I set the icons size:
<override_macro name="message_as_html" requires="message">
    <n.if.either condition1="[n.is_deleted/]" condition2="[n.is_deactivated/]">
        <then>
            <b><t>CONTENTS DELETED</t></b>
            <div class="weak-color"><t>The author has deleted this message.</t></div>
        </then>
        <else>
            <n.set_var. name="output">
                <n.as_html_list.process_message_html />
            </n.set_var.>
            
            <n.if.is_imported_mail>
                <then>
                    <n.set_var. name="output">
                        <n.remove_unsubscription_link.var name="output" />
                    </n.set_var.>                
                    
                    <n.comment>
                        PART 1: Copy the attachment links to a variable
                    </n.comment>
                    <n.set_var. name="attachments">                
                        <n.regex. text="[n.var name='output'/]" pattern="[n.attachments_regex/]">
                            <n.if.find>
                                <then.found/>
                            </n.if.find>
                        </n.regex.>                
                    </n.set_var.>           

                    <script language="JavaScript">
                        $(document).ready(function() {                               
                        $('#attachments img').addClass("clip_icon");                                
                        })                               
                    </script>                     
                    
                    <n.regex. text="[n.var name='attachments'/]" pattern="[n.href_regex/]">
                        <n.loop.>      
                            <n.set_var. name="thumb_url">                              
                                <n.regex_replace_all text ="[n.current_element/]" pattern="href=" replacement =''/>     
                            </n.set_var.>        
                            
                            <n.regex. text="[n.var name='thumb_url'/]" pattern="\w+\.(jpg|jpeg|gif|png|JPG|JPEG|GIF|PNG)">
                                <n.if.find>
                                    <then>                                            
                                        <n.set_var. name="thumb_url">                                   
                                           <n.regex_replace_all text ="[n.var name='thumb_url'/]" pattern="href=" replacement =''/>         
                                        </n.set_var.>   

                                        <script language="JavaScript">
                                            $(document).ready(function() {
                                            var new_thumb = <n.var name='thumb_url'/> ;
                                            console.log(new_thumb);
                                            var icon = $(".clip_icon").first();
                                            icon.removeClass("clip_icon");
                                            console.log("icon:"+icon.attr("src"));
                                            icon.attr("src",new_thumb);
                                            icon.attr("style","height:100px;width:100px");                                           
                                            })                                           
                                        </script>
                                        
                                    </then>
                                </n.if.find>
                            </n.regex.>  
                        </n.loop.>
                    </n.regex.>  
 
                    
                    <n.comment>
                        PART 2: Rebuild the "output" variable by placing the attachments at the top.
                        At the end, we remove the old attachments so that we don't show duplicate links.
                    </n.comment>
                    <n.set_var. name="output">
                        <div id ="attachments">
                        <n.var name='attachments' />
                        </div>
                        <br/>
                        <n.regex_replace_all text ="[n.var name='output'/]" pattern="[n.attachments_regex/]" replacement ='' />
                    </n.set_var.>    
                                       
                    
                </then>                    
            </n.if.is_imported_mail>
            <n.var name="output" />
        </else>
    </n.if.either>
</override_macro> 
My test forum.
Reply | Threaded
Open this post in threaded view
|

RE: Possible to display JPG attachment in email

Coleen_Astalos

Pedro,

I tested the change.  On the forum the picture Icons work great and look like this:

(This is an improvement as before they would have been just the first image like in this post: http://forum.sudsol.org/MDS-Hybrid-Paw-Nation-td9812.html )

 

But in the email that is distributed to subscribers, the images are back to the paperclip icon instead of the images:

 

Coleen

 

Coleen Astalos, Stampin' Up! Demonstrator
Alamosa, CO, [hidden email]
See my website at http://alamosa.stampinup.net
Are you a demonstrator? Join me on SUDSOL - Your 24/7 Upline!

 

From: Pedro <Nabble> [via Nabble Support] [mailto:[hidden email]]
Sent: Saturday, May 31, 2014 3:05 PM
To: Coleen_Astalos
Subject: RE: Possible to display JPG attachment in email

 

Please, try this code. Note that, at line 56 I set the icons size:

 
<override_macro name="message_as_html" requires="message">
    <n.if.either condition1="[n.is_deleted/]" condition2="[n.is_deactivated/]">
        <then>
            <b><t>CONTENTS DELETED</t></b>
            <div class="weak-color"><t>The author has deleted this message.</t></div>
        </then>
        <else>
            <n.set_var. name="output">
                <n.as_html_list.process_message_html />
            </n.set_var.>
            
            <n.if.is_imported_mail>
                <then>
                    <n.set_var. name="output">
                        <n.remove_unsubscription_link.var name="output" />
                    </n.set_var.>                
                    
                    <n.comment>
                        PART 1: Copy the attachment links to a variable
                    </n.comment>
                    <n.set_var. name="attachments">                
                        <n.regex. text="[n.var name='output'/]" pattern="[n.attachments_regex/]">
                            <n.if.find>
                                <then.found/>
                            </n.if.find>
                        </n.regex.>                
                    </n.set_var.>           
 
                    <script language="JavaScript">
                        $(document).ready(function() {                               
                        $('#attachments img').addClass("clip_icon");                                
                        })                               
                    </script>                     
                    
                    <n.regex. text="[n.var name='attachments'/]" pattern="[n.href_regex/]">
                        <n.loop.>      
                            <n.set_var. name="thumb_url">                              
                                <n.regex_replace_all text ="[n.current_element/]" pattern="href=" replacement =''/>     
                            </n.set_var.>        
                            
                            <n.regex. text="[n.var name='thumb_url'/]" pattern="\w+\.(jpg|jpeg|gif|png|JPG|JPEG|GIF|PNG)">
                                <n.if.find>
                                    <then>                                            
                                        <n.set_var. name="thumb_url">                                   
                                           <n.regex_replace_all text ="[n.var name='thumb_url'/]" pattern="href=" replacement =''/>         
                                        </n.set_var.>   
 
                                        <script language="JavaScript">
                                            $(document).ready(function() {
                                            var new_thumb = <n.var name='thumb_url'/> ;
                                            console.log(new_thumb);
                                            var icon = $(".clip_icon").first();
                                            icon.removeClass("clip_icon");
                                            console.log("icon:"+icon.attr("src"));
                                            icon.attr("src",new_thumb);
                                            icon.attr("style","height:100px;width:100px");                                           
                                            })                                           
                                        </script>
                                        
                                    </then>
                                </n.if.find>
                            </n.regex.>  
                        </n.loop.>
                    </n.regex.>  
 
                    
                    <n.comment>
                        PART 2: Rebuild the "output" variable by placing the attachments at the top.
                        At the end, we remove the old attachments so that we don't show duplicate links.
                    </n.comment>
                    <n.set_var. name="output">
                        <div id ="attachments">
                        <n.var name='attachments' />
                        </div>
                        <br/>
                        <n.regex_replace_all text ="[n.var name='output'/]" pattern="[n.attachments_regex/]" replacement ='' />
                    </n.set_var.>    
                                       
                    
                </then>                    
            </n.if.is_imported_mail>
            <n.var name="output" />
        </else>
    </n.if.either>
</override_macro> 

My test forum.

 


If you reply to this email, your message will be added to the discussion below:

http://support.nabble.com/Possible-to-display-JPG-attachment-in-email-tp7589178p7590395.html

To unsubscribe from Possible to display JPG attachment in email, click here.
NAML

Reply | Threaded
Open this post in threaded view
|

RE: Possible to display JPG attachment in email

Pedro
Please, try this:
<override_macro name="message_as_html" requires="message">
    <n.if.either condition1="[n.is_deleted/]" condition2="[n.is_deactivated/]">
        <then>
            <b><t>CONTENTS DELETED</t></b>
            <div class="weak-color"><t>The author has deleted this message.</t></div>
        </then>
        <else>
            <n.set_var. name="output">
                <n.as_html_list.process_message_html />
            </n.set_var.>
            
            <n.if.is_imported_mail>
                <then>
                    <n.set_var. name="output">
                        <n.remove_unsubscription_link.var name="output" />
                    </n.set_var.>                
                    
                    <n.comment>
                        PART 1: Copy the attachment links to a variable
                    </n.comment>
                    <n.set_var. name="attachments">                
                        <n.regex. text="[n.var name='output'/]" pattern="[n.attachments_regex/]">
                            <n.if.find>
                                <then.found/>
                            </n.if.find>
                        </n.regex.>                
                    </n.set_var.>          
                   
                    <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="150px" width="150px" \>           
                            </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.>  
 
                    
                    <n.comment>
                        PART 2: Rebuild the "output" variable by placing the attachments at the top.
                        At the end, we remove the old attachments so that we don't show duplicate links.
                    </n.comment>
                    <n.set_var. name="output">
                        <div id ="attachments">
                        <n.var name='attachments' />
                        </div>
                        <br/>
                        <n.regex_replace_all text ="[n.var name='output'/]" pattern="[n.attachments_regex/]" replacement ='' />
                    </n.set_var.>                                           
                    
                </then>                    
            </n.if.is_imported_mail>
            <n.var name="output" />
        </else>
    </n.if.either>
</override_macro> 
My test forum.
Reply | Threaded
Open this post in threaded view
|

RE: Possible to display JPG attachment in email

Coleen_Astalos
Works perfect.  Thank you, thank you, thank you, THANK YOU!!!
Coleen
12