Support » Plugin: WPeMatico RSS Feed Fetcher » [Plugin: WPeMatico] Link rel enclosure to img

  • Resolved frinkky


    The feed I have to work with (from a news agency so cannot be changed) contains images using <link rel=”enclosure” type=”image/jpg” href=”url” title=”title” />. At present this obviously is not working.

    Is there a way to convert the <links /> to <img src/>? The rewrite function doesn’t handle it – will the pro version be able to handle this or do I need to pre-parse the xml feed?

    Thanks in advance

    p.s. Forgot title on last thread – must have needed more coffee 😉

Viewing 3 replies - 1 through 3 (of 3 total)
  • Ok, rather than messing around with pre-parsing. I’ve edited the following function at around line 298 of campaign_fetch_functions.php to match links rather than imgs (works according to this regex tester):

    /*** Devuelve todas las imagenes del contenido	*/
    function parseImages($text){
    preg_match_all('/<link rel=\"enclosure\" type=\"image\/jpg\" href=\"(.+?)\"(.+?)\/>/', $text, $out);
    return $out;

    I’ve also edited (around line 238) with changes in comments:

    if($this->cfg['imgcache'] || $campaign['campaign_imgcache']) {
    $images = $this->parseImages($this->current_item['entry']); // Was 'content'
    $this->current_item['images'] = $images[1];  // Was $images[2] - lista de url de imagenes
    $itemUrl = $this->getReadUrl($item->get_permalink());

    Still, although the new regex is picking up the urls for the images, albeit in an array, no image is being cached/linked whatever. No errors in the logs either.

    Any ideas?

    Thought I’d upload a shot of the regex results:

    Plugin Author etruel


    can you give the feed that you are using?
    you can contact me here: and I’ll answer you by email

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: WPeMatico] Link rel enclosure to img’ is closed to new replies.