Thread tagged as: Question, Problem, Blog

Create absolute path for image upload

On a blog post, how can I make the image upload to the post an absolute path without having to hard code it into the HTML?

Jose Reyes

Jose Reyes 0 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

It should be root-relative by default. Is that not what you're seeing? Could you give an example?

Yes, you are correct.

At the moment when the image is uploaded the path is as follows: src="/perch/resources/image4-61-.jpg

I would like the path to be absolute like so: src="

Is that possible to do without hard-coding each image in the HTML mode of the WYSIWYG?

Drew McLellan

Drew McLellan 2638 points
Perch Support

I don't think so. What's the use case for that?

The client wants an RSS driven email campaign with Mailchimp. She wants the complete post to be sent as posted on the blog post itself. When the campaign is triggered and everything is sent, the complete post does display-with the exception of the images. I checked with Mailchimp as to why the images are not displaying, and the path is the issue. They are relative to the site. If the images were absolute paths, then they would show up on the campaign email blast.

Any suggestions on how to fix this?

Drew McLellan

Drew McLellan 2638 points
Perch Support

You can use

<perch:setting id="siteURL" />

which will output the value of the "Website URL" field on the Settings page. Does that help?

I'm afraid not...

Rachel Andrew

Rachel Andrew 394 points
Perch Support

Why doesn't that help? I'm not sure from that what you have tried?

I plugged in the line of code as suggested, but the image paths on the RSS feed still show as relative paths.

It still shows up...

<img style="" src="/perch/resources/1a-1-.jpg">

Need it to come up as... <img style="" src="">

This is the RSS Feed URL

Please review and advise.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you show us that part of your template?

On the rss page itself I have the following code...

<rss version="2.0" xmlns:atom="">
        <title>Sharon Palmer, RD</title>
        <description>Sharon Palmer is a registered dietitian that writes about plant based nutrition. </description>
        <atom:link href="" rel="self" type="application/rss+xml" />

On the template page, to show the complete post I have the following code...

           <title><perch:blog id="postTitle" /></title>
           <link><perch:blog id="postURL" /></link>
           <guid><perch:blog id="postURL" /></guid>
           <description><![CDATA[<perch:blog id="postDescHTML" encode="false" />]]>
           <pubDate><perch:blog id="postDateTime" format="D, d M Y H:i:s O" /></pubDate>

I hope I answered your question correctly.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ah, so the images are not structured data, but just inline within a post?

Correct, according to the documentation the following line is what is needed for the entire blog post to show.

<description><![CDATA[<perch:blog id="postDescHTML" encode="false" />]]></description>

If it broke it down, I would be able to just hard-code the URL before the loop, but it's all dynamically embedded in this line of code.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Which editor are you using?

I use a combination of when I'm not at my computer, or need to do some coding on my iPad on the go. On my laptop, I use Dreamweaver.

Drew McLellan

Drew McLellan 2638 points
Perch Support

I mean for Perch - are you using MarkItUp or Redactor or CKEditor or TinyMCE or something else?

I have this exact issue, using Markitup. I want to have absolute URLS for images uploaded in a textarea in a blog post (for RSS purposes). Is this possible? Seems like it should be a Markitup setting or something?