• Resolved jamiebaker

    (@jamiebaker)


    I’ve happily used email subscribers/icegram express for many years, to send out post notifications and broadcasts. I’ve only recently started including IMAGES in my posts. 

    It appears that broadcasts use images embedded in the email, and they show up fine at the other end BUT images in the post notification emails (using the {{post.image}} tag) show as a BROKEN image link.

    Perhaps because I have hot linking protection turned on? (to save on bandwidth thievery) thus, the hot linked images in post notifications don’t work? 

    Is there a way to have those images in the post notification emails embedded in the emails rather than simply linked to the image files on my website? 

    OR

    Perhaps I’m doing something wrong?

    Thank you!

    JB

    The page I need help with: [log in to see the link]

Viewing 13 replies - 1 through 13 (of 13 total)
  • Hi @jamiebaker,
    Thanks for reaching out to Icegram.
    We’re looking into the issue you mentioned and will update you shortly.

    Hi @jamiebaker,

    Thank you for your support!

    For further troubleshooting, could you please turn off the hotlink protection and attempt to send a test post notification? If the post image is still broken, could you share a screenshot of what you see when the image is not displaying correctly?

    Additionally, could you let us know where you enabled the hotlink protection—was it on the plugin site or from the server side? When you turn it off, please check both options and try again.

    I look forward to your response.

    Plugin Contributor Shubhanshu Kandani

    (@shubhanshukandani)

    Hi @jamiebaker ,
    Hope you’re doing great.

    I wanted to check in with you regarding the inquiry you had the other day. Was it resolved? Do you need any additional help? I’d be happy to assist you in any case.

    Thank you!
    Have a great day ahead.

    Thread Starter jamiebaker

    (@jamiebaker)

    Shubhanshu Kandani, Hello! yes, I aim still curious as to whether the images in broadcasts and post notifications are embedded within the emails, or merely hot linked to my site. please let me know me know.

    thank you!

    JB

    Plugin Contributor Shubhanshu Kandani

    (@shubhanshukandani)

    Hi @jamiebaker ,

    Thanks for following up!

    You’re correct.. currently in Icegram Express, images in broadcasts are embedded directly into emails, which is why they display correctly for your recipients.

    However, images in post notifications (using {{post.image}}) are hot-linked, meaning the email references the image from your website rather than embedding it. This is likely why your hotlink protection is causing the images to break in post notifications.

    At the moment, Icegram Express doesn’t include a built-in option to automatically embed post images in post notifications. Here are a few possible approaches you can consider:

    1. Temporarily disable hotlink protection for post notification images.
    2. Use a custom email template where you manually embed images if embedding is essential.
    3. Adjust your hotlink rule to allow image access when a specific parameter is present for example, allow requests when the URL includes ?email=true.
      If this is possible on your server, we can provide you with a small custom code snippet that automatically adds the email=true parameter to all outgoing post notification emails.

    We’re also noting this feedback for our roadmap since embedding post images automatically in notifications could be a valuable enhancement.

    Looking forward to hearing your thoughts!

    Thread Starter jamiebaker

    (@jamiebaker)

    Shubhanshu Kandani thank you for that clarification!

    1. I would rather not turn off hot linking.

    2. do you have documentation on how to set up a CUSTOM EMAIL TEMPLATE? this might be the fix for me

    3. CurrenIly, I !am doing hotllink protection via cpanel, and do not think I have the ability to add code snippets. In is an off or on binary setting (I think?). Is there another way of doing hotline protection NOT using cpanel? This also might be a fix that could work for me!

    Thanks again for all your help!

    James

    Plugin Contributor Shubhanshu Kandani

    (@shubhanshukandani)

    Hi @jamiebaker,

    Thanks for the quick response and for sharing more details that helps a lot!

    1. Absolutely, keeping hotlink protection on makes sense.
    2. Regarding hotlink protection, cPanel’s version is indeed quite restrictive. Some hosts let you manage hotlink protection via .htaccess rules that allows adding exceptions (for instance, permitting requests from your own domain or email clients). You could check with your hosting provider if they can enable that flexibility for you.

    We’ll also keep your use case in mind, adding an option to embed post images automatically could be a useful improvement for future versions.

    Let us know if you’d like help setting up the custom template… we’d be happy to guide you through it!

    Thread Starter jamiebaker

    (@jamiebaker)

    Shubhanshu Kandani 

    yes please explain how to set up the custom template that includes the post image!

    JB

    Plugin Contributor Shubhanshu Kandani

    (@shubhanshukandani)

    @jamiebaker Sure! I’m checking some alternatives for you and will update you shortly.

    Plugin Contributor Shubhanshu Kandani

    (@shubhanshukandani)

    HI @jamiebaker,

    Sure! You can set up a custom template to display your post images using a base64 image format.

    Please add the following code snippet to your site:

    <?php
    function process_base64_shortcode($content, $postId = null) {
        if ($postId === null) {
            global $post;
            $postId = $post->ID;
        }
        
        if (strpos($content, '{{post.base64_image}}') === false) {
            return $content;
        }
        
        if (has_post_thumbnail($postId)) {
            $imageUrl = get_the_post_thumbnail_url($postId, 'full');
            $base64DataURI = wp_image_to_base64_data_uri($imageUrl);
            
            if (!empty($base64DataURI)) {
                $imageId = get_post_thumbnail_id($postId);
                $altText = get_post_meta($imageId, '_wp_attachment_image_alt', true);
                if (empty($altText)) {
                    $altText = get_the_title($postId);
                }
                
                $imgTag = '<img src="' . esc_attr($base64DataURI) . '" alt="' . esc_attr($altText) . '" class="post-base64-image" />';
                $content = str_replace('{{post.base64_image}}', $imgTag, $content);
            } else {
                $content = str_replace('{{post.base64_image}}', '', $content);
            }
        } else {
            $content = str_replace('{{post.base64_image}}', '', $content);
        }
        
        return $content;
    }
    
    add_filter( 'ig_es_post_notification_body', 'add_base64_post_image', 10, 2 );
    
    function add_base64_post_image( $es_templ_body, $post_id ) {
        $es_templ_body = process_base64_shortcode( $es_templ_body, $post_id );
        return $es_templ_body;
    }
    

    Once added, you can use the {{post.base64_image}} keyword in your campaign content to display the post image automatically.

    Hi @jamiebaker,
    Hope you’re doing great.

    I wanted to check in with you regarding the inquiry you had the other day. Was it resolved? Do you need any additional help? I’d be happy to assist you in any case.

    Thank you!
    Have a great day ahead.

    Thread Starter jamiebaker

    (@jamiebaker)

    Anupam Khatua

    Yes, it seems to be resolved, even without the code snippet that was recently posted. Has there been a recent update that changed anything? Anyway, thanks for your help!

    JB

    Hi @jamiebaker,

    Thanks for your confirmation!

    Awesome, I am glad to hear that your issue has been resolved. You can ping me whenever you need any assistance. Additionally,

    I would like to tell you that we did not change anything in our recent updates.

    Warm Regards,

Viewing 13 replies - 1 through 13 (of 13 total)

The topic ‘hotlinked images in broadcasts & post notifications?’ is closed to new replies.