XML_FEED_ITEM_IMAGE does not display image from media:content

Papapooch

Member
Hello. We are running Mailwizz version 1.8.6. We have been using XML FEED from our https://clarion.causeaction.com/feed/ site for a long time with good results.
But I just tried to add Images with this code.

Code:
<a href="[XML_FEED_ITEM_LINK]"><img height="100" src="XML_FEED_ITEM_IMAGE" width="100" /> </a>
And we see the empty image with the message "The linked image cannot be displayed".
The email source has, where the image should be: src="XML_FEED_ITEM_IMAGE" .

Our Feed has the namespace reference media:content as in below:

Code:
<media:content url="https://i2.wp.com/clarion.causeaction.com/wp-content/uploads/2020/09/Supreme-court-Ginsburg-death-1200x790-1.jpg?fit=1024%2C674&#038;ssl=1" medium="image" />
And in the PHP file CampaignXmlFeedParser.php I see the code:

Code:
   if (empty($itemMap['image']) && !empty($namespaces['media'])) {
                $media = $item->children($namespaces['media']);
                if (!empty($media) && isset($media->content)) {
                    $itemMap['image'] = (string)$media->content;
                }
Which I thought would parse the media:content tag. But it does not.
How can I make this work?
Must I somehow alter the code to parse the url attribute of the media:content tag?

Thank you
 

Papapooch

Member
Thank you for noticing my rookie code mistake.

I edited the code and I think it is OK now.

Code:
<a href="[XML_FEED_ITEM_LINK]"><img height="100" src="[XML_FEED_ITEM_IMAGE]" width="100" /> </a>
This is what is being rendered in the email.

<img height="100" src="" width="100">

The src comes back empty.
 

Papapooch

Member
Also, can you supply me with the new code so I can edit the current PHP to CREATE a temporary fix? I will save a copy of the original PHP file in case I make a mistake.

Thanks
 

laurentiu

Active Member
Staff member Support Staff
Also, can you supply me with the new code so I can edit the current PHP to CREATE a temporary fix? I will save a copy of the original PHP file in case I make a mistake.
Today we will make a new release and this fix will be available.
 

Papapooch

Member
@twisted1919 - I did not see the announcement on the forum for the new update. I just downloaded it from Code Canyon and will run the update tonight. I will let you know how it works. Thanks
 
Top