PDA

View Full Version : Import image from RSS to website


Mathias
01-19-2008, 10:57 AM
Hi!

I've got a little problem using Pixelpost with Wordpress.

I want to show a thumbnail of my last Pixelpost picture in the sidebar of my Wordpress blog. I have a RSS widget in my sidebar, and with the widget I can format my RSS-feeds like this:

<li><a href='^link$' title='^description$'>^title$</a></li>

Can anybody what I have to do, to show my thumnail here? I've tried:
<img src='^enclosure=>url$' />

but it didn't work.

Thanks in advance!

dhdesign
01-19-2008, 11:55 AM
Try using image instead of enclosure.

The code to show the thumbnail is around line 122 in includes/functions_feeds.php. The whole line of code is:

$output .= "\t\t&lt;img src=&quot;".$image."&quot;&gt;&lt;br/&gt;\n";

The code for the enclosure just produces a link to the full-size image, not the thumbnail.

Hope this helps!

Mathias
01-19-2008, 12:41 PM
Thanks, it works! Just one little problem; $image gives the link to the full size picture, is it possible to get a link to the thumbnail, or do I have to resize it with the width-attribute? I hope it's possible to link to the thumbnail because a full size picture is slow!

Thanks a lot!

Dkozikowski
01-19-2008, 12:45 PM
http://www.example.com/pixelpost/thumbnails/thumb_$image

Dkozikowski
01-19-2008, 12:50 PM
OR, you said you were using an RSS widget.

So you must have Pixelpost's RSS options to show the full-sized image. You will have to alter your Pixelpost RSS settings to show thumbnails or hack your RSS widget so it adds the necessary thumb_ prefix.

If you want, I can send you my own custom widget. A user requested I re-write this plugin, http://weblog.raminia.com/wp-hacks/ , to support multiple pixelpost blogs and I finished doing that only a day or two ago. I can send you my plugin or widget as you call it.

Mathias
01-19-2008, 01:01 PM
But $image gives the complete path to the image... So I get: www.mydomain.com/pixelpost/thumbnails/thumb_http:/www.mydomein...

Or is it my doing something wrong?

Mathias
01-19-2008, 01:04 PM
The widget you wrote is written for wordpress? In that case it would be very kind of you to send it to me! You'll find my email in the board administration?

Dkozikowski
01-19-2008, 01:12 PM
Yes, the widget is for Wordpress.

Download: Latest Pixelpost Photo (for WP) v1.05 (http://public.dwilkinsjr.com/pixelpost/myaddons/LPP105.zip)

And some crude documentation: http://www.dwilkinsjr.com/public/pixelpost/docs/wp_latestphoto.html

If you cannot figure out the relative path, give me the link to your Wordpress blog and Pixelpost blog and i'll be able to map it out for you.

Mathias
01-19-2008, 01:45 PM
My Wordpress blog: http://blog.hetinstituut.be
My Pixelpost blog: http://fotoblog.hetinstituut.be

I want to place the photo in my sidebar. Here's the code:

<hr />
<div id="sidebar-main" class="secondary">
<?php /* Widgets/SBM Check */ if ( !(function_exists('dynamic_sidebar') and dynamic_sidebar(1)) ) { ?>

<div id="search"><h4><?php _e('Search','k2_domain'); ?></h4>
<?php include (TEMPLATEPATH . '/searchform.php'); ?>
</div>


<?php /* Menu for subpages of current page */
global $notfound;
if (is_page() and ($notfound != '1')) {
$current_page = $post->ID;
while($current_page) {
$page_query = $wpdb->get_row("SELECT ID, post_title, post_status, post_parent FROM $wpdb->posts WHERE ID = '$current_page'");
$current_page = $page_query->post_parent;
}
$parent_id = $page_query->ID;
$parent_title = $page_query->post_title;

$page_menu = wp_list_pages('echo=0&sort_column=menu_order&title_li=&child_of='. $parent_id);
if ($page_menu) {
?>

<div class="sb-pagemenu">
<h4><?php echo $parent_title; ?> <?php _e('Subpagina\'s','k2_domain'); ?></h4>

<ul>
<?php echo $page_menu; ?>
</ul>

<?php if ($parent_id != $post->ID) { ?>
<a href="<?php echo get_permalink($parent_id); ?>"><?php printf(__('Terug naar %s','k2_domain'), $parent_title ) ?></a>
<?php } ?>
</div>
<?php } } ?>


<?php if (is_attachment()) { ?>
<div class="sb-pagemenu">
<a href="<?php echo get_permalink($post->post_parent); ?>" rev="attachment"><?php printf(__('Terug naar \'%s\'','k2_domain'), get_the_title($post->post_parent) ) ?></a>
</div>
<?php } ?>

<?php if (!is_home() and !is_page() and !is_single() or is_paged()) { ?>

<div class="sb-about">
<h4><?php _e('Over','k2_domain'); ?></h4>

<?php /* Category Archive */ if (is_category()) { ?>
<p><?php printf(__('Je surft momenteel in de %1$s weblogarchieven van de %2$s categorie.','k2_domain'), '<a href="' . get_settings('siteurl') .'">' . get_bloginfo('name') . '</a>', single_cat_title('', false) ) ?></p>

<?php /* Day Archive */ } elseif (is_day()) { ?>
<p><?php printf(__('e surft momenteel in de %1$s weblogarchieven voor de dag %2$s.','k2_domain'), '<a href="' . get_settings('siteurl') .'">' . get_bloginfo('name') . '</a>', get_the_time(__('l, F jS, Y','k2_domain'))) ?></p>

<?php /* Monthly Archive */ } elseif (is_month()) { ?>
<p><?php printf(__('You are currently browsing the %1$s weblog archives for the month %2$s.','k2_domain'), '<a href="'.get_settings('siteurl').'">'.get_bloginfo('name').'</a>', get_the_time(__('F, Y','k2_domain'))) ?></p>

<?php /* Yearly Archive */ } elseif (is_year()) { ?>
<p><?php printf(__('You are currently browsing the %1$s weblog archives for the year %2$s.','k2_domain'), '<a href="'.get_settings('siteurl').'">'.get_bloginfo('name').'</a>', get_the_time('Y')) ?></p>

<?php /* Search */ } elseif (is_search()) { ?>
<p><?php printf(__('Je doorzocht de %1$s weblogarchieven voor \'<strong>%2$s</strong>\'.','k2_domain'),'<a href="'.get_settings('siteurl').'">'.get_bloginfo('name').'</a>', wp_specialchars($s)) ?></p>

<?php /* Author Archive */ } elseif (is_author()) { ?>
<p><?php printf(__('Archief van <strong>%s</strong>.','k2_domain'), get_the_author()) ?></p>
<p><?php the_author_description(); ?></p>

<?php } elseif (function_exists('is_tag') and is_tag()) { ?>
<p><?php printf(__('You are currently browsing the %1$s weblog archives for \'%2$s\' tag.','k2_domain'), '<a href="'.get_settings('siteurl').'">'.get_bloginfo('name').'</a>', get_query_var('tag') ) ?></p>

<?php /* Paged Archive */ } elseif (is_paged()) { ?>
<p><?php printf(__('You are currently browsing the %s weblog archives.','k2_domain'), '<a href="'.get_settings('siteurl').'">'.get_bloginfo('name').'</a>') ?></p>

<?php } ?>
</div>
<?php } ?>

<?php /* Brian's Latest Comments */ if ((function_exists('blc_latest_comments')) and is_home()) { ?>
<div class="sb-comments sb-comments-blc">
<h4><?php _e('Comments','k2_domain'); ?></h4>
<a href="<?php bloginfo('comments_rss2_url'); ?>" title="<?php _e('RSS Feed for all Comments','k2_domain'); ?>" class="feedlink"><span><?php _e('RSS','k2_domain'); ?></span></a>
<ul>
<?php blc_latest_comments('5','3','false'); ?>
</ul>
</div>
<?php } ?>

<?php /* Latest Entries */ if ( (is_home()) or (is_search() or (is_404()) or (defined('K2_NOT_FOUND'))) or (function_exists('is_tag') and is_tag()) or ( (is_archive()) and (!is_author()) ) ) { ?>
<div class="sb-latest">
<h4><?php _e('Latest','k2_domain'); ?></h4>
<a href="<?php bloginfo('rss2_url'); ?>" title="<?php _e('RSS Feed for Blog Entries','k2_domain'); ?>" class="feedlink"><span><?php _e('RSS','k2_domain'); ?></span></a>

<ul>
<?php wp_get_archives('type=postbypost&limit=10'); ?>
</ul>
</div>
<?php } ?>


<?php /* Related Posts Plugin */ if ( (function_exists('related_posts')) and is_single() and !defined('K2_NOT_FOUND') ) { ?>
<div class="sb-related">
<h4><?php _e('Related Entries','k2_domain'); ?></h4>

<ul>
<?php related_posts(); ?>
</ul>
</div>
<?php } ?>

<?php /* FlickrRSS Plugin */ if ((function_exists('get_flickrRSS')) and is_home() and !(is_paged())) { ?>
<div class="sb-flickr">
<h4><?php _e('Flickr','k2_domain'); ?></h4>
<a href="http://flickr.com/services/feeds/photos_public.gne?id=<?php echo get_option('flickrRSS_flickrid'); ?>&amp;format=rss_200" title="<?php _e('RSS Feed for flickr','k2_domain'); ?>" class="feedlink"><span><?php _e('RSS','k2_domain'); ?></span></a>

<div>
<?php get_flickrRSS(); ?>
</div>
</div>
<?php } ?>


<?php /* if ((function_exists('feedlist')) and is_home() and !(is_paged()) ) { ?>
<div class="sb-feedlist"><h4><?php _e('Feedlist','k2_domain'); ?></h4>
<ul>
<?php feedList(array("rss_feed_url"=>"",
"num_items"=>10,
"show_description"=>false,
"random"=>true,
"sort"=>"asc","new_window"=>true));
?>
</ul>
</div>
<?php } */ ?>


<?php /* Links */ if ( (is_home()) and !(is_page()) and !(is_single()) and !(is_search()) and !(is_archive()) and !(is_author()) and !(is_category()) and !(is_paged()) ) { $links_list_exist = @$wpdb->get_var("SELECT link_id FROM $wpdb->links LIMIT 1"); if($links_list_exist) { ?>
<div class="sb-links">
<ul>
<?php wp_list_bookmarks('title_before=<h4>&title_after=</h4>'); ?>
</ul>
</div>
<?php } } ?>


<?php /* Archives */ if ( is_archive() or is_search() or is_paged() or is_category() or (function_exists('is_tag') and is_tag()) or defined('K2_NOT_FOUND') ) { ?>
<div class="sb-months">
<h4><?php _e('Archives','k2_domain'); ?></h4>

<ul>
<?php wp_get_archives('type=monthly'); ?>
</ul>
</div>

<div class="sb-categories">
<h4><?php _e('Categories','k2_domain'); ?></h4>

<ul>
<?php wp_list_categories('title_li=&show_count=1&hierarchical=0'); ?>
</ul>

</div>
<?php } ?>

<?php } /* End Widgets/SBM check */ ?>
</div> <!-- #sidebar-main -->

<hr />
<div id="sidebar-alt" class="secondary">
<?php /* Widgets/SBM Check */ if ( !(function_exists('dynamic_sidebar') and dynamic_sidebar(2)) ) { ?>

<?php } ?>
</div> <!-- #sidebar-alt -->

<div class="clear"></div>


Any suggestion where to place the <?php show_latest_pixelpost_thumbnail(’../photoblog folder/’) ?>?

Dkozikowski
01-19-2008, 01:56 PM
You can place <?php show_latest_pixelpost_thumbnail('../photoblog folder/') ?> where the feed code used to be or above / below it


<?php show_latest_pixelpost_thumbnail('../photoblog folder/') ?>

<?php /* if ((function_exists('feedlist')) and is_home() and !(is_paged()) ) { ?>
<div class="sb-feedlist"><h4><?php _e('Feedlist','k2_domain'); ?></h4>
<ul>
<?php feedList(array("rss_feed_url"=>"",
"num_items"=>10,
"show_description"=>false,
"random"=>true,
"sort"=>"asc","new_window"=>true));
?>
</ul>
</div>
<?php } */ ?>


As for the relative path, i cannot tell you with the links you provided. I'll need to know the actual path and not a subdomain.

E.G. http://www.example.com/photoblog/ NOT http://photoblog.example.com


Anyway:

Say this is true for you:

http://www.example.com/photoblog/

AND

www.example.com/wordpress/

<?php show_latest_pixelpost_thumbnail('../photoblog/') ?>

Mathias
01-19-2008, 02:15 PM
I'm sorry, but the subdomains are my blogs, they are not in the www folder...

kevincrafts
01-19-2008, 04:12 PM
You can try the Pixelpost Promote Addon - you install the addon, then just add a line of javascript to your wordpress template.

Check it out here
(http://www.pixelpost.org/extend/addons/pixelpost-promote/)