View Full Version : increase size of pictures in rss
mucig
12-29-2006, 01:56 AM
Hi, I would like to increase the size of the images that come through for people subscribed to an rss feed. Please advise.
www.mucig.com
Dkozikowski
12-29-2006, 02:23 AM
The images in your RSS feed are pulled from your thumbnail folder.
The only alternative would be to show the fullsize images.
To do this you would have to edit your index.php file at or around line 796 for RSS and line 872 for your ATOM feed.
It would probably be possible to create your own thumbail images to the desired size you would like but it would also involve heavy modifications to index.php and you would have to do some SQL work to link each thumbnail to its respective ID #.
mucig
12-29-2006, 02:56 AM
Okay great... that helps. However, how do I alter that code to refer to the fullsize images? Please bear with me as I'm a html rookie. I believe it would be in this part of the code:
$headline = pullout($headline);
$headline = htmlspecialchars($headline,ENT_QUOTES);
$image = $cfgrow['siteurl']."thumbnails/thumb_$image";
$datetime = strtotime($datetime);
$datetime =date("D, d M Y H:i",$datetime);
$datetime .= ' ' .$tzoner;
$body = pullout($body);
$body = stripslashes($body);
$body = ereg_replace("\n","\n<br />",$body);
$body = strip_tags( $body );
$body = htmlspecialchars($body,ENT_QUOTES);
$output .= "
klimin_a_s
12-29-2006, 03:07 AM
You can use this mod:
Find text (approx. line 757) in the index.php file:
// ################################################## ########################################//
// RSS 2.0 FEED
// ################################################## ########################################//
if(isset($_GET['x'])&&$_GET['x'] == "rss")
{
$output = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<rss version=\"2.0\">
<channel>
<title>".$pixelpost_site_title."</title>
<link>".$cfgrow['siteurl']."</link>
<description>$pixelpost_site_title photoblog</description>
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
<generator>pixelpost</generator>
";
$tzoner = $cfgrow['timezone'];
$tprefix = '+';
$tzoner = sprintf ("%01.2f", $tzoner);
if (substr($tzoner,0,1)=='-')
{
$tzoner = (substr($tzoner,1));
$tprefix = '-';
}
if ($tzoner < 10) $tzoner = "0".$tzoner;
$hh = substr($tzoner,0,2);
$mm = substr($tzoner,-2);
$tzoner = $tprefix.$hh.$mm;
$query = mysql_query("SELECT id,datetime,headline,body,image FROM ".$pixelpost_db_prefix."pixelpost WHERE (datetime<='$cdate') ORDER BY datetime desc limit 10");
while(list($id,$datetime,$headline,$body,$image) = mysql_fetch_row($query))
{
$headline = pullout($headline);
$headline = htmlspecialchars($headline,ENT_QUOTES);
$image = $cfgrow['siteurl']."thumbnails/thumb_$image";
$datetime = strtotime($datetime);
$datetime =date("D, d M Y H:i",$datetime);
$datetime .= ' ' .$tzoner;
$body = pullout($body);
$body = stripslashes($body);
$body = strip_tags( $body );
$body = htmlspecialchars($body,ENT_QUOTES);
$body = ereg_replace("\n","\n<br />",$body);
$output .= "
<item>
<title>$headline</title>
<link>".$cfgrow['siteurl']."?showimage=$id</link>
<description>
<img src="$image">
<br />$body
</description>
<pubDate>$datetime</pubDate>
<guid>".$cfgrow['siteurl']."index.php?showimage=$id</guid>
</item>
";
}
$output .= "
</channel>
</rss>";
header("Content-type:application/xml");
echo $output;
exit;
}
Then copy this fragment one more time, replace this code:
if(isset($_GET['x'])&&$_GET['x'] == "rss")
by this
if(isset($_GET['x'])&&$_GET['x'] == "rss2")
Then you must replace this code
$image = $cfgrow['siteurl']."thumbnails/thumb_$image";
by this
$image = $cfgrow['siteurl']."images/$image";
Now you have two rss-feeds (rss and rss2). Tune your Pixelpost template rss-link (ex. http://your.pixelpost.site/index.php?x=rss2).
Dkozikowski
12-29-2006, 03:20 AM
Okay great... that helps. However, how do I alter that code to refer to the fullsize images? Please bear with me as I'm a html rookie. I believe it would be in this part of the code:
$headline = pullout($headline);
$headline = htmlspecialchars($headline,ENT_QUOTES);
$image = $cfgrow['siteurl']."thumbnails/thumb_$image";
$datetime = strtotime($datetime);
$datetime =date("D, d M Y H:i",$datetime);
$datetime .= ' ' .$tzoner;
$body = pullout($body);
$body = stripslashes($body);
$body = ereg_replace("\n","\n<br />",$body);
$body = strip_tags( $body );
$body = htmlspecialchars($body,ENT_QUOTES);
$output .= "
Or, if you can care less about having 2 RSS feeds, 1 for thumbnails and 1 for full size just alter the above bolded code to the following:
images/$image
mucig
12-29-2006, 03:20 AM
Klimin ... thanks for the detailed response. However, I tired it and now the site pulls up a blank screen. Here is the result of what I changed (as I attempted to follow your instructions)
if(isset($_GET['x'])&&$_GET['x'] == "rss2")
{
$output = "<?xml version="1.0\" encoding=\"UTF-8\"?>
<rss version=\"2.0\">
<channel>
<title>".$pixelpost_site_title."</title>
<link>".$cfgrow['siteurl']."</link>
<description>$pixelpost_site_title photoblog</description>
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
<generator>pixelpost</generator>
";
$tzoner = $cfgrow['timezone'];
$tprefix = '+';
$tzoner = sprintf ("%01.2f", $tzoner);
if (substr($tzoner,0,1)=='-')
{
$tzoner = (substr($tzoner,1));
$tprefix = '-';
}
if ($tzoner < 10) $tzoner = "0".$tzoner;
$hh = substr($tzoner,0,2);
$mm = substr($tzoner,-2);
$tzoner = $tprefix.$hh.$mm;
$query = mysql_query("SELECT id,datetime,headline,body,image FROM ".$pixelpost_db_prefix."pixelpost WHERE (datetime<='$cdate') ORDER BY datetime desc limit 10");
while(list($id,$datetime,$headline,$body,$image) = mysql_fetch_row($query))
{
$headline = pullout($headline);
$headline = htmlspecialchars($headline,ENT_QUOTES);
$image = $cfgrow['siteurl']."images/$image";
$datetime = strtotime($datetime);
$datetime =date("D, d M Y H:i",$datetime);
$datetime .= ' ' .$tzoner;
$body = pullout($body);
$body = stripslashes($body);
$body = strip_tags( $body );
$body = htmlspecialchars($body,ENT_QUOTES);
$body = ereg_replace("\n","\n<br />",$body);
$output .= "
<item>
<title>$headline</title>
<link>".$cfgrow['siteurl']."?showimage=$id</link>
<description>
<img src="$image">
<br />$body
</description>
<pubDate>$datetime</pubDate>
<guid>".$cfgrow['siteurl']."index.php?showimage=$id</guid>
</item>
";
}
$output .= "
</channel>
</rss>";
header("Content-type:application/xml");
echo $output;
exit;
}
Dkozikowski
12-29-2006, 03:23 AM
What Klimin was refering to was adding a 2nd RSS and not altering the original.
mucig
12-29-2006, 03:26 AM
I understand... thank you very much to both of you "dwilkinsjr" and "Klimin". I followed the easy instructions and it works great. Thanks so much again.
Dkozikowski
12-29-2006, 03:32 AM
Also, if you want to integrate it more, find the folowing:
// ################################################## ########################################//
// RSS- + ATOM - tags
// ################################################## ########################################//
// keeping this "old" tag because it is used in user's template maybe
$atom_url = "http://".$HTTP_HOST.$REQUEST_URI."&x=atom";
$tpl = str_replace("<ATOM_AUTODETECT>",$atom_url,$tpl);
$atom_auto = "<link rel=\"service.feed\" type=\"application/x.atom+xml\" title=\"$pixelpost_site_title - ATOM Feed\" href=\"".$cfgrow["siteurl"]."index.php?x=atom\" />";
$tpl = ereg_replace("<ATOM_AUTODETECT_LINK>",$atom_auto,$tpl);
$tpl = ereg_replace("<SITE_ATOM_LINK>","<a href='./index.php?x=atom'>ATOM feed</a>",$tpl);
$rss_auto = "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"$pixelpost_site_title - RSS Feed\" href=\"".$cfgrow["siteurl"]."index.php?x=rss\" />";
$tpl = ereg_replace("<RSS_AUTODETECT_LINK>",$rss_auto,$tpl);
$tpl = ereg_replace("<SITE_RSS_LINK>","<a href='./index.php?x=rss'>RSS 2.0</a>",$tpl);
and replace it with the following:
// ################################################## ########################################//
// RSS- + ATOM - tags
// ################################################## ########################################//
// keeping this "old" tag because it is used in user's template maybe
$atom_url = "http://".$HTTP_HOST.$REQUEST_URI."&x=atom";
$tpl = str_replace("<ATOM_AUTODETECT>",$atom_url,$tpl);
$atom_auto = "<link rel=\"service.feed\" type=\"application/x.atom+xml\" title=\"$pixelpost_site_title - ATOM Feed\" href=\"".$cfgrow["siteurl"]."index.php?x=atom\" />";
$tpl = ereg_replace("<ATOM_AUTODETECT_LINK>",$atom_auto,$tpl);
$tpl = ereg_replace("<SITE_ATOM_LINK>","<a href='./index.php?x=atom'>ATOM feed</a>",$tpl);
$rss_auto = "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"$pixelpost_site_title - RSS Feed\" href=\"".$cfgrow["siteurl"]."index.php?x=rss\" />";
$tpl = ereg_replace("<RSS_AUTODETECT_LINK>",$rss_auto,$tpl);
$tpl = ereg_replace("<SITE_RSS_LINK>","<a href='./index.php?x=rss'>RSS 2.0</a>",$tpl);
$tpl = ereg_replace("<SITE_RSS_LINK_FULL>","<a href='./index.php?x=rss2'>RSS 2.0</a>",$tpl);
And this will allow you to use
<SITE_RSS_LINK_FULL>
in your template files.
mucig
12-29-2006, 03:41 AM
dwilkinsjr - this might be a stupid question but what does <SITE_RSS_LINK_FULL> do for me?
mucig
12-29-2006, 03:45 AM
Also, I noticed my code is different... it doesn't refer to RSS 2.0:
// ################################################## ########################################//
// RSS- + ATOM - tags
// ################################################## ########################################//
// keeping this "old" tag because it is used in user's template maybe
$atom_url = "http://".$HTTP_HOST.$REQUEST_URI."&x=atom";
$tpl = str_replace("<ATOM_AUTODETECT>",$atom_url,$tpl);
$atom_auto = "<link rel=\"service.feed\" type=\"application/x.atom+xml\" title=\"$pixelpost_site_title - ATOM Feed\" href=\"".$cfgrow["siteurl"]."index.php?x=atom\" />";
$tpl = ereg_replace("<ATOM_AUTODETECT_LINK>",$atom_auto,$tpl);
$tpl = ereg_replace("<SITE_ATOM_LINK>","<a href='./index.php?x=atom'>ATOM feed</a>",$tpl);
$rss_auto = "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"$pixelpost_site_title - RSS Feed\" href=\"".$cfgrow["siteurl"]."index.php?x=rss\" />";
$tpl = ereg_replace("<RSS_AUTODETECT_LINK>",$rss_auto,$tpl);
$tpl = ereg_replace("<SITE_RSS_LINK>","<a href='./index.php?x=rss'>RSS</a>",$tpl);
Dkozikowski
12-29-2006, 04:13 AM
Don't worry about the 2.0
The code I gave you was specifically for displaying your RSS link in your template body.
For example, is you used <SITE_RSS_LINK_FULL> In your footer it would make a link to your RSS feed with full images on your template footer.
If you wish to use a tag for your template header its different. Add the following in bold like so:
// ################################################## ########################################//
// RSS- + ATOM - tags
// ################################################## ########################################//
// keeping this "old" tag because it is used in user's template maybe
$atom_url = "http://".$HTTP_HOST.$REQUEST_URI."&x=atom";
$tpl = str_replace("<ATOM_AUTODETECT>",$atom_url,$tpl);
$atom_auto = "<link rel=\"service.feed\" type=\"application/x.atom+xml\" title=\"$pixelpost_site_title - ATOM Feed\" href=\"".$cfgrow["siteurl"]."index.php?x=atom\" />";
$tpl = ereg_replace("<ATOM_AUTODETECT_LINK>",$atom_auto,$ tpl);
$tpl = ereg_replace("<SITE_ATOM_LINK>","<a href='./index.php?x=atom'>ATOM feed</a>",$tpl);
$rss_auto = "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"$pixelpost_site_title - RSS Feed\" href=\"".$cfgrow["siteurl"]."index.php?x=rss\" />";
$rss_auto_full = "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"$pixelpost_site_title - RSS Feed\" href=\"".$cfgrow["siteurl"]."index.php?x=rss2\" />";
$tpl = ereg_replace("<RSS_AUTODETECT_LINK_FULL>",$rss_auto_full,$tpl);
$tpl = ereg_replace("<RSS_AUTODETECT_LINK>",$rss_auto,$tp l);
$tpl = ereg_replace("<SITE_RSS_LINK>","<a href='./index.php?x=rss'>RSS</a>",$tpl);
Then use <RSS_AUTODETECT_LINK_FULL> in the head of your template(s) between the <head></head> tags.
vBulletin® v3.7.3, Copyright ©2000-2013, Jelsoft Enterprises Ltd.