Forum
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?
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?
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="https://www.mywebsite.com/perch/resources/image4-61-.jpg
Is that possible to do without hard-coding each image in the HTML mode of the WYSIWYG?
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.
https://sharonpalmer.com/blog.php
https://sharonpalmer.com/rss.php
Any suggestions on how to fix this?
You can use
which will output the value of the "Website URL" field on the Settings page. Does that help?
I'm afraid not...
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="https://www.sharonpalmer.com/perch/resources/1a-1-.jpg">
This is the RSS Feed URL https://sharonpalmer.com/rss.php
Please review and advise.
Can you show us that part of your template?
On the rss page itself I have the following code...
On the template page, to show the complete post I have the following code...
I hope I answered your question correctly.
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.
Which editor are you using?
I use a combination of condeanywhere.com 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.
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?