Full path to images in rss feed?

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Full path to images in rss feed?

Post by Don Chambers »

How does s9y supply the full path to an image in an rss feed when the image is inserted into the entry as only a relative path?

For example, I have an image that is inserted via the media manager into the entry as "/uploads/myimage1.png". I have done this on both a live site, as well as a test site.

On the test site, the rss2 feed includes the full path to the image, ie "http://mydomain.com/uploads/myimage1.png". However, the exact same entry on a live site only includes the relative path in the rss2 feed, ie "/uploads/myimage1.png". Both are running s9y 1.7.2 and PHP 5.2.17.
=Don=
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Full path to images in rss feed?

Post by garvinhicking »

Don Chambers wrote:How does s9y supply the full path to an image in an rss feed when the image is inserted into the entry as only a relative path?
In include/functions_rss.inc.php is the print_entries_rss function that holds this line of code:

Code: Select all

$entry['body'] = preg_replace('@(href|src)=("|\')(' . preg_quote($serendipity['serendipityHTTPPath']) . ')(.*)("|\')(.*)>@imsU', '\1=\2' . $serendipity['baseURL'] . '\4\2\6>', $entry['body']);
This is there to replace the relative links. So the only way I see this working in one install and not the other with identical markups is, that the "serendipityHTTPPath" url variable might not be set to "/" for example, so it would never match a <a href="/...">- ot maybe even if baseURL is not set to the full URL of the blog?

HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply