4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Requests & Discussions) => Topic started by: netlovers on December 02, 2007, 01:41:38 PM

Title: Thumbnails in RSS
Post by: netlovers on December 02, 2007, 01:41:38 PM
Is it possible to also display thumbnail of image with the name of image in RSS.Because by default it only shows names of images in RSS.
Title: Re: Thumbnails in RSS
Post by: thunderstrike on December 02, 2007, 02:23:28 PM
Hum ...

// Step 1

In rss.php file,

find:

Code: [Select]
'title' => format_rss_text($row['image_name']),

add after:

Code: [Select]
'image' => get_thumbnail_code($row['image_media_file'], $row['image_thumb_file'], $row['image_id'], $row['cat_id'], format_rss_text($row['image_name']), ((isset($mode) && !empty($mode)) ? $mode : ""), 1),

find:

Code: [Select]
'item_title' => $item['title'],

add after:

Code: [Select]
'item_image' => $item['image'],

// Step 2

In templates/your_template/rss_item.xml file,

find:

Code: [Select]
<title>{item_title}</title>

add after:

Code: [Select]
<image>{item_image}</image>

Is work ?
Title: Re: Thumbnails in RSS
Post by: netlovers on December 02, 2007, 06:53:08 PM
No it is not working.  :cry:
Title: Re: Thumbnails in RSS
Post by: thunderstrike on December 02, 2007, 07:20:40 PM
I no good with RSS ...
I add in TODO - if find - I post. ;)
Title: Re: Thumbnails in RSS
Post by: wallpapers on May 27, 2008, 10:15:18 PM
I no good with RSS ...
I add in TODO - if find - I post. ;)

And any solutions for this question?
I know it's a old post but this is the only topic for what i looking for.
Title: Re: Thumbnails in RSS
Post by: mawenzi on May 27, 2008, 10:22:48 PM
... only a hint for a solution : here (http://klick.kl.funpic.de/showthread.php?bid=3&threadid=42&page=1) ...
... and the feed looks like this (http://klick.kl.funpic.de/rss.php) ...
Title: Re: Thumbnails in RSS
Post by: wallpapers on May 28, 2008, 08:11:53 PM
Thx
it works great.
just what i want :D
Title: Re: Thumbnails in RSS
Post by: mawenzi on May 28, 2008, 09:20:53 PM
... nice to read, that it works great for you and that I could help ... :)
Title: Re: Thumbnails in RSS
Post by: J.Lond on June 04, 2008, 03:11:54 PM
... only a hint for a solution : here (http://klick.kl.funpic.de/showthread.php?bid=3&threadid=42&page=1) ...
... and the feed looks like this (http://klick.kl.funpic.de/rss.php) ...

Can you turn on the download for the zip files in your gallery please.  I am quite interested in this mod.  Thank you.
Title: Re: Thumbnails in RSS
Post by: Mr Kennedy on June 04, 2008, 04:14:28 PM
... only a hint for a solution : here (http://klick.kl.funpic.de/showthread.php?bid=3&threadid=42&page=1) ...
... and the feed looks like this (http://klick.kl.funpic.de/rss.php) ...

Can you turn on the download for the zip files in your gallery please.  I am quite interested in this mod.  Thank you.

dito würde mich sehr freuen zu sehen wie Thumbnails in RSS funktionieren :)
Title: Re: Thumbnails in RSS
Post by: Bob on June 04, 2008, 04:41:46 PM
von mir auch ein Dito nicht nur wegen den Thumbs sonder auch die ganze Formatierung ist sehr gut :)

würde mich sehr freuen wenn mawenzi den DL freigibt

Gruss
Bob
Title: Re: Thumbnails in RSS
Post by: mawenzi on June 11, 2008, 04:18:11 PM
... danke, dass euch mein Feed so gut gefällt ...
... wenn ich nächste Woche wieder am heimischen PC sitze, dann geht es für euch in der Download-Area weiter ...
... bis dahin bitte etwas Geduld ...
Title: Re: Thumbnails in RSS
Post by: J.Lond on June 20, 2008, 12:05:43 PM
... danke, dass euch mein Feed so gut gefällt ...
... wenn ich nächste Woche wieder am heimischen PC sitze, dann geht es für euch in der Download-Area weiter ...
... bis dahin bitte etwas Geduld ...


Yes thank you I will wait.
Title: Re: Thumbnails in RSS
Post by: silentg on June 21, 2008, 04:53:05 AM
Patiently waiting for the mod downloads.
Thanks to google translator :lol:
Title: Re: Thumbnails in RSS
Post by: Bob on June 24, 2008, 01:02:54 AM
... danke, dass euch mein Feed so gut gefällt ...
... wenn ich nächste Woche wieder am heimischen PC sitze, dann geht es für euch in der Download-Area weiter ...
... bis dahin bitte etwas Geduld ...


Möchte ja nicht drängeln...

aber hat sich leider nichts getan bis jetzt, ich möchte gerne sehen wie du das gemacht hast (neugierig bin) .

Title: Re: Thumbnails in RSS
Post by: budduke on July 06, 2008, 05:03:51 PM
Not sure if I am posting this is the correct area or not but I sat down this weekend and figured a way to get the thumbnails to show up finally. Through google translator I saw that the one person was wanting donations for his mod. their mod looked great but overkill for what I wanted. I just wanted a thumnail to show up.
The main problem I had was that the readers that I was using wanted the direct path and not a relative one. the "./thumbnails" did not work. it had to be "http://www.example.com/thumbnails" in order for them to see it.
I went in and modified an already mod for external thumbnails, instead of taking a chance on things messing up elsewhere, i just renamed it to another function.
You will be modifying 3 files on your site.
rss.php
includes\functions.php
your template directory\rss_item.xml

In the rss.php file
replace
Code: [Select]
'image' => get_thumbnail_code($row['image_media_file'], $row['image_thumb_file'], $row['image_id'], $row['cat_id'], format_rss_text($row['image_name']), ((isset($mode) && !empty($mode)) ? $mode : ""), 1),
with
Code: [Select]
//rss thumbnail mod
//'image' => get_thumbnail_code($row['image_media_file'], $row['image_thumb_file'], $row['image_id'], $row['cat_id'], format_rss_text($row['image_name']), ((isset($mode) && !empty($mode)) ? $mode : ""), 1),
'image' => get_thumbnail_rss_code($row['image_media_file'], $row['image_thumb_file'], $row['image_id'], $row['cat_id'], format_rss_text($row['image_name']), ((isset($mode) && !empty($mode)) ? $mode : ""), 1),
        //

in the includes/functions.php
go to the end of the file
above
Code: [Select]
?>insert
Code: [Select]
//--External thumbnails(modified for rss feed)--------------------------------
function get_thumbnail_rss_code($media_file_name, $thumb_file_name = "", $image_id, $cat_id, $image_name = "", $mode = "", $show_link = 1, $open_window = 1) {
  global $site_sess, $config;
  $mysite = 'http://www.example.com/gallery/';// change this to the path to your 4images gallery

  if (!check_media_type($media_file_name)) {
    $thumb = "<img src=\"".$mysite.ltrim(ICON_PATH,"./")."/404.gif\" border=\"0\" alt=\"\" />";
  }
  else {
    if (!get_file_path($thumb_file_name, "thumb", $cat_id, 0, 0)) {
      $file_src = $mysite.ltrim(ICON_PATH,"./")."/".get_file_extension($media_file_name).".gif";
      $image_info = @getimagesize($file_src);
      $width_height = (!empty($image_info[3])) ? " ".$image_info[3] : "";
      $thumb = "<img src=\"".$file_src."\" border=\"0\"".$width_height." alt=\"".$image_name."\" />";
    }
    else {
      $file_src = $mysite.ltrim(get_file_path($thumb_file_name, "thumb", $cat_id, 0, 1),"./");
      $image_info = @getimagesize($file_src);
      $width_height = (!empty($image_info[3])) ? " ".$image_info[3] : "";
      $thumb = "<img src=\"".$file_src."\" border=\"".$config['image_border']."\"".$width_height." alt=\"".$image_name."\" />";
    }
  }

  if ($show_link) {
    if ($open_window) {
      $thumb = "<a href=\"".$site_sess->url($mysite."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&amp;mode=".$mode : ""))."\">".$thumb."</a>";
    }
    else {
      $thumb = "<a href=\"".$site_sess->url($mysite."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&amp;mode=".$mode : ""))."\">".$thumb."</a>";
    }
  }
  return $thumb;
}

//--End external thumbnails(modified for rss feed)----------------------------

note under line 4 in the above change
put in the path to your gallery directory just as you would type it in your browser
I tried using other variables from 4images but they did not seem to carry over to the readers so I just hardcoded it in the function.

in the your template folder/rss_item.xml
replace on the 5th line
Code: [Select]
      <description><![CDATA[{item_description}]]></description>
with
Code: [Select]
      <description><![CDATA[<table><tr><td>{item_image}</td><td>{item_description}</td></tr></table>]]></description>

I also did the mods at the top of this post so I am not sure if you need them or not.

and you are finished.

if you look at that last change you will see that you can make this as fancy as you want.
anything between the ![CDATA[ and the ]]> is passed on to the reader without any parsing.
I made mine so that it is a table with 2 cells next to each other with the thumbnail on the left and your description of the image on the right. but you can take it from there if you want more info.

this works with yahoo, google, ie7, firefox, and a few others and passes the feed validation so I think I am good.
I did find one software reader that could not display the image, just broken links, but I think it was on thier end and not mine.

if you want to see this in action...
http://www.budduke.com/gallery/rss.php?action=images (http://www.budduke.com/gallery/rss.php?action=images)

PS: if you go to my site you will see I am using SMF forums with only one login between 4images and SMF (interested?)
It took my about 2-3 weeks to get it to work but they are using thier own database and I used some functions that someone else created for connected to thier product but when I find time I will compare all the changes I did and how hard it would be to pass the info on to everyone.
Title: Re: Thumbnails in RSS
Post by: Bob on July 06, 2008, 05:56:53 PM
THX!

nice Work mate  :thumbup:
Title: Re: Thumbnails in RSS
Post by: ripejuice on July 11, 2008, 08:16:41 PM

Can't find the below line in rss.php.
Quote
'image' => get_thumbnail_code($row['image_media_file'], $row['image_thumb_file'], $row['image_id'], $row['cat_id'], format_rss_text($row['image_name']), ((isset($mode) && !empty($mode)) ? $mode : ""), 1),

Please help.I have included my rss.php.



Code: [Select]
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: rss.php                                              *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan@4homepages.de                                    * 
 *              Web: http://www.4homepages.de                             * 
 *    Scriptversion: 1.7.6                                                *
 *                                                                        *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen (Lizenz.txt) für weitere Informationen.                 *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    (Licence.txt) for further information.                              *
 *                                                                        *
 *************************************************************************/

$main_template 'rss';

$nozip 1;
define('GET_CACHES'1);
define('ROOT_PATH''./');
include(
ROOT_PATH.'global.php');
require(
ROOT_PATH.'includes/sessions.php');
$user_access get_permission();
include(
ROOT_PATH.'includes/page_header.php');

$site_template->template_extension 'xml';

@
define('RSS_DEFAULT_ITEMS'10);
@
define('RSS_MAX_ITEMS'30);

if (isset(
$HTTP_GET_VARS['items']) || isset($HTTP_POST_VARS['items'])) {
  
$num_items = (isset($HTTP_POST_VARS['items'])) ? intval($HTTP_POST_VARS['items']) : intval($HTTP_GET_VARS['items']);
  if (!
$num_items) {
    
$num_items RSS_DEFAULT_ITEMS;
  }

  if (
$num_items RSS_MAX_ITEMS) {
    
$num_items RSS_MAX_ITEMS;
  }
}
else {
  
$num_items RSS_DEFAULT_ITEMS;
}

if (
$action == '') {
  
$action 'images';
}

function 
cut_at_word($text$length$suffix '...') {
  if (
strlen($text) <= $length) {
    return 
$text;
  }

  
$delims = array(' ''.'',''!''?''-'':''_''/');
  
$text substr($text0$length 1);

  
$positions = array();

  for (
$i 0; isset($delims[$i]); $i++) {
    
$pos strrpos($text$delims[$i]);
    if (
$pos) {
      
$positions[] = $pos;
    }
  }

  if (
sizeof($positions) > 0) {
    
rsort($positions);
    
$text substr($text0$positions[0]);
  }

  
$text .= $suffix;

  return 
$text;
}

function 
format_rss_text($text) {
  
$text format_text(trim($text), 101);
  
$text strip_tags($text);
  
$text safe_htmlspecialchars($text);

  
$text cut_at_word($text250);

  return 
$text;
}

function 
format_rss_html($text) {
  
$text format_text(trim($text), 101);

  return 
$text;
}

function 
get_file_url($file_name$image_type$cat_id)
{
    
$url get_file_path($file_name$image_type$cat_id01);

    if (!
is_remote($file_name)) {
        global 
$script_url;
        
$url $script_url.'/'.$url;
    }

    return 
str_replace('./'''$url);
}

function 
get_rss_enclosure($file_name$image_type$cat_id) {
  if (!
get_file_path($file_name$image_type$cat_id00)) {
    return array();
  }

  
$file get_file_path($file_name$image_type$cat_id01);
  
$url get_file_url($file_name$image_type$cat_id);

  return array(
    
'url' => $url,
    
'length' => @filesize($file),
    
'type' => get_mime_content_type($file)
  );
}

$cache_id create_cache_id(
  
'page.rss',
  array(
    
$user_info[$user_table_fields['user_id']],
$action,
    
$image_id,
    
$cat_id,
    
$num_items
  
)
);

if (!
$cache_page_rss || !$content get_cache_file($cache_id)) {
  
$old_session_mode $site_sess->mode;
  
$site_sess->mode 'cookie';

ob_start();

$rss_title format_rss_text($config['site_name']);
$rss_link  $site_sess->url($script_url);
$rss_desc  format_rss_text($config['site_name']);
$rss_lang  "";
$rss_image = array();
$rss_ttl   $cache_page_rss $cache_lifetime 0;
$rss_cat   = array();
$rss_items = array();

switch (
$action) {
  case 
'comments':
    if (!
$image_id) {
      exit;
    }

    
$sql "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name".get_user_table_field(", u.""user_name").get_user_table_field(", u.""user_email")."
            FROM ("
.IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
            LEFT JOIN "
.USERS_TABLE." u ON (".get_user_table_field("u.""user_id")." = i.user_id)
            WHERE i.image_id = 
$image_id AND c.cat_id = i.cat_id";
    
$image_row $site_db->query_firstrow($sql);

    if (!isset(
$image_row['image_id'])) {
      exit;
    }

    
$cat_id = (isset($image_row['cat_id'])) ? $image_row['cat_id'] : 0;

    
$rss_title .= " - " format_rss_text($image_row['image_name']);
    
$rss_link  $site_sess->url($script_url."/details.php?".URL_IMAGE_ID."=".$image_id);
    
$rss_desc  format_rss_html($image_row['image_description']);
    if (
get_file_path($image_row['image_thumb_file'], "thumb"$cat_id00)) {
      
$rss_image = array(
        
'url' => get_file_url($image_row['image_thumb_file'], "thumb"$cat_id),
        
'title' => format_rss_text($image_row['image_name']),
        
'link' => $rss_link
      
);
    }

    
$rss_cat = array(
      
'name' => format_rss_text($cat_cache[$cat_id]['cat_name']),
      
'domain' => $site_sess->url($script_url."/categories.php?".URL_CAT_ID."=".$cat_id)
    );

    
$image_allow_comments = (check_permission("auth_readcomment"$cat_id)) ? $image_row['image_allow_comments'] : 0;

    
$sql "SELECT c.comment_id, c.image_id, c.user_id, c.user_name AS comment_user_name, c.comment_headline, c.comment_text, c.comment_ip, c.comment_date".get_user_table_field(", u.""user_level").get_user_table_field(", u.""user_name").get_user_table_field(", u.""user_email").get_user_table_field(", u.""user_showemail").get_user_table_field(", u.""user_invisible").get_user_table_field(", u.""user_joindate").get_user_table_field(", u.""user_lastaction").get_user_table_field(", u.""user_comments").get_user_table_field(", u.""user_homepage").get_user_table_field(", u.""user_icq")."
            FROM "
.COMMENTS_TABLE." c
            LEFT JOIN "
.USERS_TABLE." u ON (".get_user_table_field("u.""user_id")." = c.user_id)
            WHERE c.image_id = 
$image_id
            ORDER BY c.comment_date DESC
            LIMIT 
$num_items";
    
$result $site_db->query($sql);

    while (
$row $site_db->fetch_array($result)) {
      
$user_name format_rss_text($row['comment_user_name']);
      
$user_email "example@example.com";

      if (isset(
$row[$user_table_fields['user_name']]) && $row['user_id'] != GUEST) {
        
$user_name format_rss_text($row[$user_table_fields['user_name']]);
        if (!empty(
$row[$user_table_fields['user_email']]) && (!isset($row[$user_table_fields['user_showemail']]) || (isset($row[$user_table_fields['user_showemail']]) && $row[$user_table_fields['user_showemail']] == 1))) {
          
$user_email $row[$user_table_fields['user_email']];
        }
      }

      
$rss_items[] = array(
        
'title' => format_rss_text($row['comment_headline']),
        
'link' => $site_sess->url($script_url."/details.php?".URL_IMAGE_ID."=".$image_id."#comment".$row['comment_id']),
        
'pubDate' => $row['comment_date'],
        
'desc' => format_rss_text($row['comment_text']),
        
'category' => array(
          
'name' => $rss_title,
          
'domain' => $rss_link
        
),
        
'author' => array(
          
'name' => $user_name,
          
'email' => $user_email
        
),
      );
    }
    break;

  case 
'images':
  default:
    
$cat_sql "";
    if (
$cat_id && isset($cat_cache[$cat_id])) {
      
$rss_title .= " - " format_rss_text($cat_cache[$cat_id]['cat_name']);
      
$rss_link  $site_sess->url($script_url."/categories.php?".URL_CAT_ID."=".$cat_id);
      
$rss_desc  format_rss_html($cat_cache[$cat_id]['cat_description']);

      
$cat_sql "AND i.cat_id = $cat_id";
    }

    
$sql "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name".get_user_table_field(", u.""user_name")."
            FROM ("
.IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
            LEFT JOIN "
.USERS_TABLE." u ON (".get_user_table_field("u.""user_id")." = i.user_id)
            WHERE i.image_active = 1
              
$cat_sql
              AND c.cat_id = i.cat_id
              AND i.cat_id NOT IN ("
.get_auth_cat_sql("auth_viewcat""NOTIN").")
            ORDER BY i.image_date DESC
            LIMIT 
$num_items";
    
$result $site_db->query($sql);

    while (
$row $site_db->fetch_array($result)) {
      
$user_name format_rss_text($lang['userlevel_guest']);
      
$user_email "example@example.com";

      if (isset(
$row[$user_table_fields['user_name']]) && $row['user_id'] != GUEST) {
        
$user_name format_rss_text($row[$user_table_fields['user_name']]);
        if (!empty(
$row[$user_table_fields['user_email']]) && (!isset($row[$user_table_fields['user_showemail']]) || (isset($row[$user_table_fields['user_showemail']]) && $row[$user_table_fields['user_showemail']] == 1))) {
          
$user_email $row[$user_table_fields['user_email']];
        }
      }

      
$rss_items[] = array(
        
'title' => format_rss_text($row['image_name']),
        
'link' => $site_sess->url($script_url."/details.php?".URL_IMAGE_ID."=".$row['image_id']),
        
'pubDate' => $row['image_date'],
        
'desc' => format_rss_html($row['image_description']),
        
'category' => array(
          
'name' => format_rss_text($cat_cache[$row['cat_id']]['cat_name']),
          
'domain' => $site_sess->url($script_url."/categories.php?".URL_CAT_ID."=".$row['cat_id'])
        ),
        
'enclosure' => get_rss_enclosure($row['image_thumb_file'], "thumb"$row['cat_id']),
        
'author' => array(
          
'name' => $user_name,
          
'email' => $user_email
        
),
        
'comments' => $site_sess->url($script_url."/details.php?".URL_IMAGE_ID."=".$row['image_id']."#comments"),
      );
    }
    break;
}

$items '';

foreach (
$rss_items as $item) {
  
$tpl_vars = array(
    
'item_title' => $item['title'],
    
'item_link' => $item['link'],
    
'item_pubdate' => gmdate('D, d M Y H:i:s'$item['pubDate']) . " GMT",
    
'item_description' => $item['desc'],
    
'item_category' => false,
    
'item_category_domain' => '',
    
'item_category_name' => '',
    
'item_author' => false,
    
'item_author_email' => '',
    
'item_author_name' => '',
    
'item_enclosure' => false,
    
'item_enclosure_url' => '',
    
'item_enclosure_length' => '',
    
'item_enclosure_type' => '',
  );

  if (@
count($item['category']) > 0) {
    
$tpl_vars['item_category'] = true;
    
$tpl_vars['item_category_domain'] = $item['category']['domain'];
    
$tpl_vars['item_category_name'] = $item['category']['name'];
  }

  if (@
count($item['author']) > 0) {
    
$tpl_vars['item_author'] = true;
    
$tpl_vars['item_author_email'] = $item['author']['email'];
    
$tpl_vars['item_author_name'] = $item['author']['name'];
  }

  if (@
count($item['enclosure']) > 0) {
    
$tpl_vars['item_enclosure'] = true;
    
$tpl_vars['item_enclosure_url'] = $item['enclosure']['url'];
    
$tpl_vars['item_enclosure_length'] = $item['enclosure']['length'];
    
$tpl_vars['item_enclosure_type'] = $item['enclosure']['type'];
  }

  
$site_template->register_vars($tpl_vars);
  
$items .= $site_template->parse_template("rss_item");
}

$tpl_vars = array(
  
'channel_title' => $rss_title,
  
'channel_link' => $rss_link,
  
'channel_pubdate' => gmdate('D, d M Y H:i:s') . " GMT",
  
'channel_description' => $rss_desc,
  
'channel_image' => false,
  
'channel_image_url' => '',
  
'channel_image_title' => '',
  
'channel_image_link' => '',
  
'channel_ttl' => $rss_ttl,
  
'items' => $items
);

if (
count($rss_image) > 0) {
  
$tpl_vars['channel_image'] = true;
  
$tpl_vars['channel_image_url'] = $rss_image['url'];
  
$tpl_vars['channel_image_title'] = $rss_image['title'];
  
$tpl_vars['channel_image_link'] = $rss_image['link'];
}

$site_template->register_vars($tpl_vars);

$site_template->print_template($site_template->parse_template($main_template));

$content ob_get_contents();
ob_end_clean();

// Reset session mode
$site_sess->mode $old_session_mode;

if (
$cache_page_rss) {
  
save_cache_file($cache_id$contenttrue);
}

// end if get_cache_file()

header('Content-Type: text/xml');
header('Expires: ' gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');

echo 
$content;


?>
Title: Re: Thumbnails in RSS
Post by: budduke on July 12, 2008, 12:42:22 AM
Sorry, that was my bad...
Like I said in my post, I did the changes that Thunderstrike had posted on the first page of this topic before I did mine...

If you have not done any of the mods from the first page
you will need to do this instead...
In the rss.php file

look for

Code: [Select]
'title' => format_rss_text($row['image_name']),
add after

Code: [Select]
//rss thumbnail mod
'image' => get_thumbnail_rss_code($row['image_media_file'], $row['image_thumb_file'], $row['image_id'], $row['cat_id'], format_rss_text($row['image_name']), ((isset($mode) && !empty($mode)) ? $mode : ""), 1),
//


and you should be good to go...


Title: Re: Thumbnails in RSS
Post by: Kurman on October 02, 2008, 03:49:11 AM
Good MOD, can used instead of MOD show images in external page.

I've installed it, but RSS feed can view thumbnail if as feed I use RSS path of a sinle page, for example take RSS link from the detailed page? while viewing an image.

But if I use RSS llink from index page or catagories page, I've RSS feeded only titles and text, without thumbnail preview.
What could cause this?

link to my site (http://foto.kurman.ru)
Title: Re: Thumbnails in RSS
Post by: V@no on October 02, 2008, 07:18:20 AM
I just checked, budduke's changes work fine. (I first did the changes from original tutorial on first page)
Title: Re: Thumbnails in RSS
Post by: budduke on October 02, 2008, 12:23:58 PM
Good MOD, can used instead of MOD show images in external page.

I've installed it, but RSS feed can view thumbnail if as feed I use RSS path of a sinle page, for example take RSS link from the detailed page? while viewing an image.

But if I use RSS llink from index page or catagories page, I've RSS feeded only titles and text, without thumbnail preview.
What could cause this?

link to my site (http://foto.kurman.ru)

make the changes that I suggested above and things should work fine...
you can see what it should look like at
http://www.budduke.com/gallery/rss.php?action=images (http://www.budduke.com/gallery/rss.php?action=images)

let me know if it is not working for you...
Title: Re: Thumbnails in RSS
Post by: Kurman on October 03, 2008, 07:30:30 AM
Yes, after I did this step from the first page, it works fine.

find in rss.php:

Code: [Select]
'item_title' => $item['title'],
add after:

Code: [Select]
'item_image' => $item['image'],
Thanks guys!
Title: Re: Thumbnails in RSS
Post by: yousaf on May 29, 2009, 02:05:56 PM
i was unable to make it work as i have missed the first page's steps by thunderstrike.
now it is working for me but i see difference between mine and yours RSS.

i have attached a snapshot of my rss as well as yours RSS snapshot too, so that you can see and tell me what i missed in editing.
Title: Re: Thumbnails in RSS
Post by: budduke on May 29, 2009, 05:14:54 PM
i was unable to make it work as i have missed the first page's steps by thunderstrike.
now it is working for me but i see difference between mine and yours RSS.

i have attached a snapshot of my rss as well as yours RSS snapshot too, so that you can see and tell me what i missed in editing.


Can you post a link to your rss feed?
What browser are you using. Some act different with feeds...
Title: Re: Thumbnails in RSS
Post by: yousaf on May 29, 2009, 07:42:48 PM
http://www.wallpaperowner.com/rss.php?action=images (http://www.wallpaperowner.com/rss.php?action=images)

this is the link to my gallery
Title: Re: Thumbnails in RSS
Post by: budduke on May 29, 2009, 08:11:56 PM
http://www.wallpaperowner.com/rss.php?action=images (http://www.wallpaperowner.com/rss.php?action=images)

this is the link to my gallery

Your feed looks entirely different then mine  :?:
Can you zip and attach your rss.php file and I will compare the setup with mine?
I won't have time to look at it till this weekend when I get home from work but not sure at this moment why yours is different.
We both have 1.7.7 so they should look the same. Do you have any other MODS that may have reformatted the RSS feed?
Title: Re: Thumbnails in RSS
Post by: yousaf on May 29, 2009, 08:21:35 PM
sure i am attaching my RSS.php file for you.
its a fresh installation of 4images 1.7.7 and i have just 3 mods on the script
which are Google Search engine friendly links, thumbnails in RSS and Google Sitemap.
Title: Re: Thumbnails in RSS
Post by: yousaf on May 29, 2009, 08:25:32 PM
There is a 4th mod installed as well Dynamic Page Title but none of the mods mentioned have anything to do with RSS.php
Title: Re: Thumbnails in RSS
Post by: budduke on May 29, 2009, 09:16:19 PM
sure i am attaching my RSS.php file for you.
its a fresh installation of 4images 1.7.7 and i have just 3 mods on the script
which are Google Search engine friendly links, thumbnails in RSS and Google Sitemap.


Look for on line 273?
Code: [Select]
        'enclosure' => get_rss_enclosure($row['image_thumb_file'], "thumb", $row['cat_id']),

replace with or put // in front of it
Code: [Select]
//        'enclosure' => get_rss_enclosure($row['image_thumb_file'], "thumb", $row['cat_id']),

That should take that extra link out, not sure if that is why I did it on mine or not, usually I comment things so I know why I did it but it was remmed out on my rss.php file

Hope that fixes it for you,
Title: Re: Thumbnails in RSS
Post by: yousaf on May 29, 2009, 09:26:05 PM
just like i want it,
Thanks alot its working  :D
Title: Re: Thumbnails in RSS
Post by: manager on August 01, 2009, 03:27:23 AM
Not sure if I am posting this is the correct area or not but I sat down this weekend and figured a way to get the thumbnails to show up finally. Through google translator I saw that the one person was wanting donations for his mod. their mod looked great but overkill for what I wanted. I just wanted a thumnail to show up.
The main problem I had was that the readers that I was using wanted the direct path and not a relative one. the "./thumbnails" did not work. it had to be "http://www.example.com/thumbnails" in order for them to see it.
I went in and modified an already mod for external thumbnails, instead of taking a chance on things messing up elsewhere, i just renamed it to another function.
You will be modifying 3 files on your site.
rss.php
includes\functions.php
your template directory\rss_item.xml

In the rss.php file
replace
Code: [Select]
'image' => get_thumbnail_code($row['image_media_file'], $row['image_thumb_file'], $row['image_id'], $row['cat_id'], format_rss_text($row['image_name']), ((isset($mode) && !empty($mode)) ? $mode : ""), 1),
with
Code: [Select]
//rss thumbnail mod
//'image' => get_thumbnail_code($row['image_media_file'], $row['image_thumb_file'], $row['image_id'], $row['cat_id'], format_rss_text($row['image_name']), ((isset($mode) && !empty($mode)) ? $mode : ""), 1),
'image' => get_thumbnail_rss_code($row['image_media_file'], $row['image_thumb_file'], $row['image_id'], $row['cat_id'], format_rss_text($row['image_name']), ((isset($mode) && !empty($mode)) ? $mode : ""), 1),
        //

in the includes/functions.php
go to the end of the file
above
Code: [Select]
?>insert
Code: [Select]
//--External thumbnails(modified for rss feed)--------------------------------
function get_thumbnail_rss_code($media_file_name, $thumb_file_name = "", $image_id, $cat_id, $image_name = "", $mode = "", $show_link = 1, $open_window = 1) {
  global $site_sess, $config;
  $mysite = 'http://www.example.com/gallery/';// change this to the path to your 4images gallery

  if (!check_media_type($media_file_name)) {
    $thumb = "<img src=\"".$mysite.ltrim(ICON_PATH,"./")."/404.gif\" border=\"0\" alt=\"\" />";
  }
  else {
    if (!get_file_path($thumb_file_name, "thumb", $cat_id, 0, 0)) {
      $file_src = $mysite.ltrim(ICON_PATH,"./")."/".get_file_extension($media_file_name).".gif";
      $image_info = @getimagesize($file_src);
      $width_height = (!empty($image_info[3])) ? " ".$image_info[3] : "";
      $thumb = "<img src=\"".$file_src."\" border=\"0\"".$width_height." alt=\"".$image_name."\" />";
    }
    else {
      $file_src = $mysite.ltrim(get_file_path($thumb_file_name, "thumb", $cat_id, 0, 1),"./");
      $image_info = @getimagesize($file_src);
      $width_height = (!empty($image_info[3])) ? " ".$image_info[3] : "";
      $thumb = "<img src=\"".$file_src."\" border=\"".$config['image_border']."\"".$width_height." alt=\"".$image_name."\" />";
    }
  }

  if ($show_link) {
    if ($open_window) {
      $thumb = "<a href=\"".$site_sess->url($mysite."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&amp;mode=".$mode : ""))."\">".$thumb."</a>";
    }
    else {
      $thumb = "<a href=\"".$site_sess->url($mysite."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&amp;mode=".$mode : ""))."\">".$thumb."</a>";
    }
  }
  return $thumb;
}

//--End external thumbnails(modified for rss feed)----------------------------

note under line 4 in the above change
put in the path to your gallery directory just as you would type it in your browser
I tried using other variables from 4images but they did not seem to carry over to the readers so I just hardcoded it in the function.

in the your template folder/rss_item.xml
replace on the 5th line
Code: [Select]
      <description><![CDATA[{item_description}]]></description>
with
Code: [Select]
      <description><![CDATA[<table><tr><td>{item_image}</td><td>{item_description}</td></tr></table>]]></description>

I also did the mods at the top of this post so I am not sure if you need them or not.

and you are finished.

if you look at that last change you will see that you can make this as fancy as you want.
anything between the ![CDATA[ and the ]]> is passed on to the reader without any parsing.
I made mine so that it is a table with 2 cells next to each other with the thumbnail on the left and your description of the image on the right. but you can take it from there if you want more info.

this works with yahoo, google, ie7, firefox, and a few others and passes the feed validation so I think I am good.
I did find one software reader that could not display the image, just broken links, but I think it was on thier end and not mine.

if you want to see this in action...
http://www.budduke.com/gallery/rss.php?action=images (http://www.budduke.com/gallery/rss.php?action=images)

PS: if you go to my site you will see I am using SMF forums with only one login between 4images and SMF (interested?)
It took my about 2-3 weeks to get it to work but they are using thier own database and I used some functions that someone else created for connected to thier product but when I find time I will compare all the changes I did and how hard it would be to pass the info on to everyone.


Thanks, I did the mod on the top of this thread, combined with this and it works! 
Title: Re: Thumbnails in RSS
Post by: whoopiedoo2 on August 15, 2009, 07:15:37 AM
I tried everything, and i can not get this mod to work.
I think my rss.php file is completly different.
Title: Re: Thumbnails in RSS
Post by: popac on September 30, 2009, 03:06:36 PM
Thank you manager, working !  :wink:
Title: Re: Thumbnails in RSS
Post by: satine88 on November 18, 2009, 11:14:02 PM
Not sure if I am posting this is the correct area or not but ......

Thanks ! :)



a full quote is not necessary... @Rembrandt
Title: Re: Thumbnails in RSS
Post by: surferboy on September 13, 2010, 09:22:07 PM
Hi -

Using v1.7.7
Mysql 5.1.47
Php 5.2.13

I have done all the changes for this MOD twice just to make sure and still no luck in getting the images to appear in the RSS feed.  Also, the RSS feed for the index page only shows the logout index page images when I try to copy the RSS feed to say google or yahoo.

Do you think the problem is that all of category permissions in the ACP are set as 'registered users?'  Should I attempt to change the setting in the category permission to 'ALL' for View Category and View Image? 

If so, can someone help with a quick sql query that I can use in phpmyadmin to change the settings? I have upwards of 200 categories now.

Thanks,

Brian
Title: Re: Thumbnails in RSS
Post by: budduke on September 14, 2010, 01:33:14 AM
Do you think the problem is that all of category permissions in the ACP are set as 'registered users?'  Should I attempt to change the setting in the category permission to 'ALL' for View Category and View Image?  

If so, can someone help with a quick sql query that I can use in phpmyadmin to change the settings? I have upwards of 200 categories now.

that is interesting, I just tried that on my test server and yes, if all your cat/images are set for registered users, the rss feed is blank, which seems right because you have to log in to see them and they are not just out there for everyone to see.

the way I would change the fields would be in the database admin panel
for the categories
Code: [Select]
UPDATE `4images_categories` SET auth_viewcat = 0
and for the images
Code: [Select]
UPDATE `4images_categories` SET auth_viewimage = 0
replacing the 4images_ with your tables name if you did not use the default settings

UPDATE: you can just change the viewcat setting and it will still work
people can then look in the category and see the thumbnail images but they can not get to the detail page to download the images unless they register
Title: Re: Thumbnails in RSS
Post by: surferboy on September 14, 2010, 03:26:06 AM
Hi Buddy Duke,

Thanks, that solved half of the problem. I executed the sql query you provided and in a blink of an eye, all the auth_viewcats were set to 0.  Thanks so much for the assist.

And now, the RSS feed for the index page did add to Google, for which I am ambivalent. I was more focused on the inclusion of RSS feeds in other pages of our website.  However, now there are two problems, one left over and just a coding housekeeping issue.

1. The image still does not appear in the RSS feed. Just the text listing. That's true in the Google feed as well as the internal website RSS feed on another page.

2. I am using an external widget studio that makes some nice looking widgets. It allows for all kinds of options to include in the RSS feed display.  So I did want to list the 'contributor' and the system lists two things: [example@example.com][userid].  The example@example.com is listed on every feed so that's just a coding issue, I'm sure. The [userid] is working properly.

[edit] - found the example@example.com in the RSS.php file. I deleted it. Just left it as $user_email = "";  Just checked and it didn't fix it but RSS feeds are not instantaneous. Hopefully that will solve item 2.
[edit2] - had a look in rss_item.xml and found the author_email code; deleted that from the CDATA section.
[edit3] - scanned this topic again, and I see to be having the same issue that Kurman had,
http://www.4homepages.de/forum/index.php?topic=19647.msg125000#msg125000

but I checked the RSS.php file for the image title and image name fix that he said fixed his problem and I had that in there. When I completely redid this RSS MOD, I followed all the steps of the first page and then added your steps from page 2.

You did ask elsewhere in this post if there were any other mods done on the RSS.php file. The only thing I could find was this:

// Reset session mode
$site_sess->mode = $old_session_mode;

if ($cache_page_rss) {
  save_cache_file($cache_id, $content, true);
}

} // end if get_cache_file()

I will PM you, hoping that is acceptable, to give you access to our website, since it is protected with aMember login.

Thanks again for your help.

- Brian
Title: Re: Thumbnails in RSS
Post by: Nosferatu on June 02, 2011, 02:55:09 PM
Hallo,

ich würde gerne im RSS neben dem Bild die Kategorie, Bildname und Datum dabei stehen haben, aber mir rss kenn ich mich irgendwie gar nicht aus.... und egal was ich schon rumprobiert habe es war nichts sichtbar ...

so sieht es derzeit aus  Link  (http://www.pj-firepower.com/picgallerie/rss.php)

rss.php

<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: rss.php                                              *
 *        Copyright: (C) 2002-2010 Jan Sorgalla                           *
 *            Email: jan@4homepages.de                                    *
 *              Web: http://www.4homepages.de                             *
 *    Scriptversion: 1.7.9                                                *
 *                                                                        *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen (Lizenz.txt) für weitere Informationen.                 *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    (Licence.txt) for further information.                              *
 *                                                                        *
 *************************************************************************/

$main_template = 'rss';

$nozip = 1;
define('GET_CACHES', 1);
define('ROOT_PATH', './');
include(ROOT_PATH.'global.php');
require(ROOT_PATH.'includes/sessions.php');
$user_access = get_permission();
include(ROOT_PATH.'includes/page_header.php');

$site_template->template_extension = 'xml';

@define('RSS_DEFAULT_ITEMS', 10);
@define('RSS_MAX_ITEMS', 30);

if (isset($HTTP_GET_VARS['items']) || isset($HTTP_POST_VARS['items'])) {
  $num_items = (isset($HTTP_POST_VARS['items'])) ? intval($HTTP_POST_VARS['items']) : intval($HTTP_GET_VARS['items']);
  if (!$num_items) {
    $num_items = RSS_DEFAULT_ITEMS;
  }

  if ($num_items > RSS_MAX_ITEMS) {
    $num_items = RSS_MAX_ITEMS;
  }
}
else {
  $num_items = RSS_DEFAULT_ITEMS;
}

if ($action == '') {
  $action = 'images';
}

function cut_at_word($text, $length, $suffix = '...') {
  if (strlen($text) <= $length) {
    return $text;
  }

  $delims = array(' ', '.', ',', '!', '?', '-', ':', '_', '/');
  $text = substr($text, 0, $length + 1);

  $positions = array();

  for ($i = 0; isset($delims[$i]); $i++) {
    $pos = strrpos($text, $delims[$i]);
    if ($pos) {
      $positions[] = $pos;
    }
  }

  if (sizeof($positions) > 0) {
    rsort($positions);
    $text = substr($text, 0, $positions[0]);
  }

  $text .= $suffix;

  return $text;
}

function format_rss_text($text) {
  $text = format_text(trim($text), 1, 0, 1);
  $text = strip_tags($text);
  $text = safe_htmlspecialchars($text);

  $text = cut_at_word($text, 250);

  return $text;
}

function format_rss_html($text) {
  $text = format_text(trim($text), 1, 0, 1);

  return $text;
}

function get_file_url($file_name, $image_type, $cat_id)
{
    $url = get_file_path($file_name, $image_type, $cat_id, 0, 1);

    if (!is_remote($file_name)) {
        global $script_url;
        $url = $script_url.'/'.$url;
    }

    return str_replace('./', '', $url);
}

function get_rss_enclosure($file_name, $image_type, $cat_id) {
  if (!get_file_path($file_name, $image_type, $cat_id, 0, 0)) {
    return array();
  }

  $file = get_file_path($file_name, $image_type, $cat_id, 0, 1);
  $url = get_file_url($file_name, $image_type, $cat_id);

  return array(
    'url' => $url,
    'length' => @filesize($file),
    'type' => get_mime_content_type($file)
  );
}

$cache_id = create_cache_id(
  'page.rss',
  array(
    $user_info[$user_table_fields['user_id']],
$action,
    $image_id,
    $cat_id,
    $num_items
  )
);

if (!$cache_page_rss || !$content = get_cache_file($cache_id)) {
  $old_session_mode = $site_sess->mode;
  $site_sess->mode = 'cookie';

ob_start();

$rss_title = format_rss_text($config['site_name']);
$rss_link  = $site_sess->url($script_url);
$rss_desc  = format_rss_text($config['site_name']);
$rss_lang  = "";
$rss_image = array();
$rss_ttl   = $cache_page_rss ? $cache_lifetime : 0;
$rss_cat   = array();
$rss_items = array();

switch ($action) {
  case 'comments':
    if (!$image_id) {
      exit;
    }

    $sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name".get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_email")."
            FROM (".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
            LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
            WHERE i.image_id = $image_id AND c.cat_id = i.cat_id";
    $image_row = $site_db->query_firstrow($sql);

    if (!isset($image_row['image_id'])) {
      exit;
    }

    $cat_id = (isset($image_row['cat_id'])) ? $image_row['cat_id'] : 0;

    $rss_title .= " - " . format_rss_text($image_row['image_name']);
    $rss_link  = $site_sess->url($script_url."/details.php?".URL_IMAGE_ID."=".$image_id);
    $rss_desc  = format_rss_html($image_row['image_description']);
    if (get_file_path($image_row['image_thumb_file'], "thumb", $cat_id, 0, 0)) {
      $rss_image = array(
        'url' => get_file_url($image_row['image_thumb_file'], "thumb", $cat_id),
        'title' => format_rss_text($image_row['image_name']),
        'link' => $rss_link
      );
    }

    $rss_cat = array(
      'name' => format_rss_text($cat_cache[$cat_id]['cat_name']),
      'domain' => $site_sess->url($script_url."/categories.php?".URL_CAT_ID."=".$cat_id)
    );

    $image_allow_comments = (check_permission("auth_readcomment", $cat_id)) ? $image_row['image_allow_comments'] : 0;

    $sql = "SELECT c.comment_id, c.image_id, c.user_id, c.user_name AS comment_user_name, c.comment_headline, c.comment_text, c.comment_ip, c.comment_date".get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_email").get_user_table_field(", u.", "user_showemail").get_user_table_field(", u.", "user_invisible").get_user_table_field(", u.", "user_joindate").get_user_table_field(", u.", "user_lastaction").get_user_table_field(", u.", "user_comments").get_user_table_field(", u.", "user_homepage").get_user_table_field(", u.", "user_icq")."
            FROM ".COMMENTS_TABLE." c
            LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = c.user_id)
            WHERE c.image_id = $image_id
            ORDER BY c.comment_date DESC
            LIMIT $num_items";
    $result = $site_db->query($sql);

    while ($row = $site_db->fetch_array($result)) {
      $user_name = format_rss_text($row['comment_user_name']);
      $user_email = "example@example.com";

      if (isset($row[$user_table_fields['user_name']]) && $row['user_id'] != GUEST) {
        $user_name = format_rss_text($row[$user_table_fields['user_name']]);
        if (!empty($row[$user_table_fields['user_email']]) && (!isset($row[$user_table_fields['user_showemail']]) || (isset($row[$user_table_fields['user_showemail']]) && $row[$user_table_fields['user_showemail']] == 1))) {
          $user_email = $row[$user_table_fields['user_email']];
        }
      }

      $rss_items[] = array(
        'title' => format_rss_text($row['comment_headline']),
        'link' => $site_sess->url($script_url."/details.php?".URL_IMAGE_ID."=".$image_id."#comment".$row['comment_id']),
        'pubDate' => $row['comment_date'],
        'desc' => format_rss_text($row['comment_text']),
        'category' => array(
          'name' => $rss_title,
          'domain' => $rss_link
        ),
        'author' => array(
          'name' => $user_name,
          'email' => $user_email
        ),
      );
    }
    break;

  case 'images':
  default:
    $cat_sql = "";
    if ($cat_id && isset($cat_cache[$cat_id])) {
      $rss_title .= " - " . format_rss_text($cat_cache[$cat_id]['cat_name']);
      $rss_link  = $site_sess->url($script_url."/categories.php?".URL_CAT_ID."=".$cat_id);
      $rss_desc  = format_rss_html($cat_cache[$cat_id]['cat_description']);

      $cat_sql = "AND i.cat_id = $cat_id";
    }

    $sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name".get_user_table_field(", u.", "user_name")."
            FROM (".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
            LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
            WHERE i.image_active = 1
              $cat_sql
              AND c.cat_id = i.cat_id
              AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")
            ORDER BY i.image_date DESC, i.image_id DESC
            LIMIT $num_items";
    $result = $site_db->query($sql);

    while ($row = $site_db->fetch_array($result)) {
      $user_name = format_rss_text($lang['userlevel_guest']);
      $user_email = "example@example.com";

      if (isset($row[$user_table_fields['user_name']]) && $row['user_id'] != GUEST) {
        $user_name = format_rss_text($row[$user_table_fields['user_name']]);
        if (!empty($row[$user_table_fields['user_email']]) && (!isset($row[$user_table_fields['user_showemail']]) || (isset($row[$user_table_fields['user_showemail']]) && $row[$user_table_fields['user_showemail']] == 1))) {
          $user_email = $row[$user_table_fields['user_email']];
        }
      }

      $rss_items[] = array(
        'title' => format_rss_text($row['image_name']),
'image' => get_thumbnail_code($row['image_media_file'], $row['image_thumb_file'], $row['image_id'], $row['cat_id'], format_rss_text($row['image_name']), ((isset($mode) && !empty($mode)) ? $mode : ""), 1),
        'link' => $site_sess->url($script_url."/details.php?".URL_IMAGE_ID."=".$row['image_id']),
        'pubDate' => $row['image_date'],
        'desc' => format_rss_html($row['image_description']),
        'category' => array(
          'name' => format_rss_text($cat_cache[$row['cat_id']]['cat_name']),
          'domain' => $site_sess->url($script_url."/categories.php?".URL_CAT_ID."=".$row['cat_id'])
        ),
        'enclosure' => get_rss_enclosure($row['image_thumb_file'], "thumb", $row['cat_id']),
        'author' => array(
          'name' => $user_name,
          'email' => $user_email
        ),
        'comments' => $site_sess->url($script_url."/details.php?".URL_IMAGE_ID."=".$row['image_id']."#comments"),
      );
    }
    break;
}

$items = '';

foreach ($rss_items as $item) {
  $tpl_vars = array(
    'item_title' => $item['title'],
'item_image' => $item['image'],
    'item_link' => $item['link'],
    'item_pubdate' => gmdate('D, d M Y H:i:s', $item['pubDate']) . " GMT",
    'item_description' => $item['desc'],
    'item_category' => true,
    'item_category_domain' => '',
    'item_category_name' => '',
    'item_author' => false,
    'item_author_email' => '',
    'item_author_name' => '',
    'item_enclosure' => false,
    'item_enclosure_url' => '',
    'item_enclosure_length' => '',
    'item_enclosure_type' => '',
  );

  if (@count($item['category']) > 0) {
    $tpl_vars['item_category'] = true;
    $tpl_vars['item_category_domain'] = $item['category']['domain'];
    $tpl_vars['item_category_name'] = $item['category']['name'];
  }

  if (@count($item['author']) > 0) {
    $tpl_vars['item_author'] = true;
    $tpl_vars['item_author_email'] = $item['author']['email'];
    $tpl_vars['item_author_name'] = $item['author']['name'];
  }

  if (@count($item['enclosure']) > 0) {
    $tpl_vars['item_enclosure'] = true;
    $tpl_vars['item_enclosure_url'] = $item['enclosure']['url'];
    $tpl_vars['item_enclosure_length'] = $item['enclosure']['length'];
    $tpl_vars['item_enclosure_type'] = $item['enclosure']['type'];
  }

  $site_template->register_vars($tpl_vars);
  $items .= $site_template->parse_template("rss_item");
}

$tpl_vars = array(
  'channel_title' => $rss_title,
  'channel_link' => $rss_link,
  'channel_pubdate' => gmdate('D, d M Y H:i:s') . " GMT",
  'channel_description' => $rss_desc,
  'channel_image' => false,
  'channel_image_url' => '',
  'channel_image_title' => '',
  'channel_image_link' => '',
  'channel_ttl' => $rss_ttl,
  'items' => $items
);

if (count($rss_image) > 0) {
  $tpl_vars['channel_image'] = true;
  $tpl_vars['channel_image_url'] = $rss_image['url'];
  $tpl_vars['channel_image_title'] = $rss_image['title'];
  $tpl_vars['channel_image_link'] = $rss_image['link'];
}

$site_template->register_vars($tpl_vars);

$site_template->print_template($site_template->parse_template($main_template));

$content = ob_get_contents();
ob_end_clean();

// Reset session mode
$site_sess->mode = $old_session_mode;

if ($cache_page_rss) {
  save_cache_file($cache_id, $content, true);
}

} // end if get_cache_file()

header('Content-Type: text/xml');
header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');

echo $content;


?>

rss_item.xml
    <item>
      <title>{item_title}</title>
      <image>{item_image}</image>
      <link>{item_link}</link>
      <pubDate>{item_pubdate}</pubDate>
  <description><![CDATA[
<table>
<tr>
<td>{item_image}</td>
<td>{item_description}</td>
</tr>
</table>]]>
</description>

 {if item_category}
      <category domain="{item_category_domain}">{item_category_name}</category>
    {endif item_category}
    {if item_author}
      <author><![CDATA[{item_author_email} ({item_author_name})]]></author>
    {endif item_author}
  
    {if item_enclosure}
      <enclosure url="{item_enclosure_url}" length="{item_enclosure_length}" type="{item_enclosure_type}" />
    {endif item_enclosure}
      <guid isPermaLink="false">{item_link}</guid>
    </item>


rss.xml
<?xml version="1.0" encoding="{charset}"?>
<rss version="2.0">
  <channel>

    <title>{channel_title}</title>
    <link>{channel_link}</link>
    <description><![CDATA[{channel_description}]]></description>
    <pubDate>{channel_pubdate}</pubDate>

  {if channel_image}
    <image>
      <url>{channel_image_url}</url>
      <title>{channel_image_title}</title>
      <link>{channel_image_link}</link>
 <author>{channel_name}</author>
    </image>
  {endif channel_image}

  {if channel_ttl}
    <ttl>{channel_ttl}</ttl>
  {endif channel_ttl}

{if items}
{items}
{endif items}

  </channel>
</rss>

Danke!

mfg
Nosferatu
Title: Re: Thumbnails in RSS
Post by: Rembrandt on June 02, 2011, 03:36:26 PM
..ich würde gerne im RSS neben dem Bild die Kategorie, Bildname und Datum dabei stehen haben, aber mir rss kenn ich mich irgendwie gar nicht aus.... und egal was ich schon rumprobiert habe es war nichts sichtbar ...
ich denke mal mit dem mod bist du ganz gut bedient:
http://www.4homepages.de/forum/index.php?topic=28187.0

mfg Andi
Title: Re: Thumbnails in RSS
Post by: Hello-world on September 29, 2012, 10:13:27 AM
it works, but in some browsers thumbnails  are not displayed, 

because of an incorrect path :

http://www.site.com/data/thumbnails/1/1.jpg

Instead of http://www.site.com/gallery/data/thumbnails/1/1.jpg

How to correct it?
Title: Re: Thumbnails in RSS
Post by: bigwave on March 28, 2013, 07:48:43 AM
Hi,
I'm getting partial success.  On my site in firefox and ie9 when I click on the rss button I get the feed with thumbnails which is very nice :D but when I try to use a feed reader in wordpress no thumbnails :?

In Chrome I get this error message: This XML file does not appear to have any style information associated with it. The document tree is shown below.

The paths in the xml file are good. 

Any suggestions on how to trouble shoot?

Thanks!

Title: Re: Thumbnails in RSS
Post by: budduke on April 04, 2013, 02:04:00 AM
Hi,
I'm getting partial success.  On my site in firefox and ie9 when I click on the rss button I get the feed with thumbnails which is very nice :D but when I try to use a feed reader in wordpress no thumbnails :?

In Chrome I get this error message: This XML file does not appear to have any style information associated with it. The document tree is shown below.

The paths in the xml file are good. 

Any suggestions on how to trouble shoot?

Thanks!



The Chrome error is because Chrome does not read rss feeds without adding an extention...
This is what another site said you need to add to get the rss feeds to work.
https://chrome.google.com/extensions/detail/nlbjncdgjeocebhnmkbbbdekmmmcbfjd (https://chrome.google.com/extensions/detail/nlbjncdgjeocebhnmkbbbdekmmmcbfjd)

Sorry, I do not work with wordpress but I wonder if it might also need a plugin or extention to read rss feeds?
Title: Re: Thumbnails in RSS
Post by: bigwave on April 04, 2013, 02:26:36 AM
Thanks very much!  That helps.  I'll try other rss reader widgets in wordpress.