How can i snip out or rezize any image that gets pulled in an RSS feed... ??
Snip out? You mean remove?
Quote from: Blue Dream on February 06, 2009, 03:22:45 AM
Snip out? You mean remove?
well by snip i mean ... remove the image but leaves a link to the image ...
eg.
(https://simpleportal.net/index.php?action=dlattach;attach=660;type=avatar)
<image snipped (http://simpleportal.net/index.php?action=dlattach;attach=660;type=avatar)>
Reason i want this .. some times it pulls in a really larggeee image .. and messes up the layout of the site
You should be able to do this with the PHP preg_replace() function and a decent regular expression. Not sure if you know much about those though.
Would you like me to try and write one?
I now have the REVERSE problem -
On my main RSS Feed (Portal Page) my 1st post under the old portal would show the RSS TEXT as well as a thumbnail image that came with the feed - now it's Text Only?
Also, the Block Size for RSS - it has gotten smaller and now use "sidebars" - anyway to go back and adjust the block size to show more feeds? and get my photos back (I see there's a new icon set too)
Otherwise - looks nice www.f-1chat.com
2.2 still has the Custom PHP block, so you can still use the old block codes in a PHP Block.
global $rss_data, $rss_current, $rss_counter;
$parameters[0] = 'http://www.formula1.com/rss/news/latest.rss';
if (empty($parameters[0]))
return;
else
$feed = $parameters[0];
$rss_data = array();
$rss_current = "";
$rss_counter = 0;
$rss_main = '';
$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "sp_startElement", "sp_endElement");
xml_set_character_data_handler($xml_parser, "sp_characterData");
if (!($fp = @fopen($feed, "r")))
return;
while ($data = fread($fp, 4096))
{
if (!xml_parse($xml_parser, $data, feof($fp)))
{
$xmlerr = (sprintf("XML error: %s at line %d",
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));
break;
}
}
fclose($fp);
xml_parser_free($xml_parser);
if (!empty($xmlerr))
{
echo $xmlerr;
return;
}
if (empty($rss_data))
return;
if (!empty($rss_data['IMAGE']))
echo '<a href="', $rss_data['LINK'], '" target="_blank"><img src="', $rss_data['IMAGE']['URL'], '" align="middle" alt="', $rss_data['IMAGE']['TITLE'], '" /></a>', $rss_data['TITLE'], '<br /><br />';
else
echo $rss_data['TITLE'], '<br />';
echo '<em>', $rss_data['DESCRIPTION'], '</em><br />';
if (isset($rss_data['ITEMS']))
{
if (count($rss_data['ITEMS']) > 0)
{
for($i = 0; $i < count($rss_data['ITEMS']); $i++)
{
echo '<span style="font-weight: bold;"><a href="', $rss_data['ITEMS'][$i]['LINK'], '" target="_blank">', $rss_data['ITEMS'][$i]['TITLE'], '</a></span><br />';
echo html_entity_decode($rss_data['ITEMS'][$i]['DESCRIPTION']) . '<br />';
if ($i != count($rss_data['ITEMS']) - 1)
echo '<hr />';
}
}
else
return;
}
Thanks for the response SiNan...
I'm using a HTML block - and not very good with PHP -
But the "code" you posted above, is that php code to be used in a php box instead of a HTML block? (sorry for stupid Q - I just want to be clear)...
I will try it... and hope it brings back my RSS pix - that was a great feature!
Thanks for the help!
KB
WORKED PERFECT!! Yeah!!!!! 8)
Thank you!!!
www.f-1chat.com
Aw06,
Did Sinan's code solve this issue for you as well?
Quote from: LHVWB on April 03, 2009, 08:32:34 PM
Aw06,
Did Sinan's code solve this issue for you as well?
i no longer use rss blocks
Topic marked solved, then.