Forum

Thread tagged as: Question, Problem, Blog

Add an image to the rss_post.php file

Here's the syntax I'm using but it isn't working:

 <image><perch:blog id="image" type="image" width="320" height="240" /></image>

Is this the correct syntax?

Darren Cusdin

Darren Cusdin 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, the syntax looks correct. Have you added it to your post.html template too?

Hey Drew,

Thanks, yes I have. I'm trying to add the image into a Campaign Monitor template and have now learned that I need to use an RSS enclosure to pull in the image. I've managed to get it working with an absolute path to an image but not having any luck with the perch tags, any ideas? Here's the working code:

<media:content
    url="https://aynhoepark.co.uk/wp-content/uploads/2015/02/The-Salon.jpg" 
    type="image/jpeg" 
    height="768" 
    width="1024"/> 

Thanks again.

James

Drew McLellan

Drew McLellan 2638 points
Perch Support

Are the dimensions there same?

They are now :)

Still not seeing the images, here's the code I'm using to try and pull in the image from my post.html template:

<media:content src="<perch:blog id="image" type="image" width="270" height="200" />" type="image/*" />

Drew McLellan

Drew McLellan 2638 points
Perch Support

Have you uploaded the images since changing the dimensions?

Just tried that - images are still not appearing.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok.. what else can you tell me?

Here's everything so far...

I'm trying to pull in an image from our post.html template using the following line of code (in a campaign monitor template):

<rssimage width="270" height="200" border="0" class="block border"></rssimage>

Here's the code from my post.html template

  <img src="<perch:blog id="image" type="image" width="320" height="240" crop="true" label="Image" order="4" />" alt="<perch:blog id="postTitle" />" />

The images work on the blog pages, but don't appear in the Campaign Monitor template.

If I use an absolute path in the above, the RSS brings the image in to the Campaign Monitor template without issue.

Therefore, the CM template and RSS tags seem to be working correctly, the issue seems to be related to the<perch:blog id="image" tag.

I have also tried republishing pages and re-uploading images to posts when updating code but nothing has taken effect.

Do you have a snippet of code from an rss_post.php file that handles rss images as an example? Is there a known issue with Perch tags contained in a <media:content /> tag? If so is there an alternative?

Thanks Drew

Drew McLellan

Drew McLellan 2638 points
Perch Support

What is the campaign monitor template, and how are you displaying it?

It's an HTML email template, I'm previewing it in the campaign monitor utility itself. The post title, author, date and content all appear perfectly. Can post the Campaign Monitor template code if useful?

Drew McLellan

Drew McLellan 2638 points
Perch Support

So this isn't in Perch?

The HTML email template isn't, but there seems to be an issue with pulling in the image from the Perch rss_post.html template. I think it would be helpful to see how you might add a blog image to this template? Preferably using <media:content /> tags rather than <image></image> tags?

Drew McLellan

Drew McLellan 2638 points
Perch Support

If you're not using Perch to display the template then Perch tags in the template won't be parsed.