Recent Topics

1 Mar 06, 2011 03:23    

Hello,

I am using an app in Facebook (RSS Graffiti) to take the post on my webpage blog, and post it to my Facebook page. The posts appear fine, but if I've included any images in the post, they don't show up.

Looking at the support forums for RSS Graffiti, it appears that the images must be inside an enclosure tag, or part of the text (??).

Wordpress users have solved this problem by changing a setting (Full Text).

Are enclosure tags or any other option available in b2evo that allows images to be included in RSS Feeds? I wasn't able to find any settings.

(Using 3.3.3)

Thanks,
Brian

2 Mar 06, 2011 03:43

Images are default in all types of B2evo feed (RSS RSS2 Atom).

Can you point me to that particular post in RSS Graffity with the description of the enclosure. It would be a really easy hack in B2evo provided the description is clear.
Adding a setting however would be a tad more difficult.

4 Mar 06, 2011 04:23

That post doesn't say what it wants the image output to be.
Try feed it RSS2 or Atom. The images should be included by default so RSS Graffity should display without you changing anything.

5 Mar 06, 2011 05:16

I am using the RSS2 feed. Not a subject I've been able to find a lot of information about, but looking at the 3.3.3 interface a little more, (its new to me), I see there is a post option "podcast". Looking at the RSS2 skin, I see this:

// PODCAST ------------------------------------------------------------------------
				if( $Item->ptyp_ID == 2000 )
				{	// This is a podcast Item !
					echo '<enclosure url="'.$Item->url.'" />';
					// TODO: add length="12216320" type="audio/mpeg"
				}

				if( $feed_content == 'excerpt' )
				{	// EXCERPTS ---------------------------------------------------------------------

I wonder if this could be modified to change the type.

Looks like the enclosure mechanism was intended for podcasts, but for some reason the RSS Grafitti people are using it for images?

6 Mar 06, 2011 05:25

I see that section of code is labeled TO DO.

Here is the RSS 2.0 Spec on this subject:

<enclosure> sub-element of <item> *

<enclosure> is an optional sub-element of <item>.

It has three required attributes. url says where the enclosure is located, length says how big it is in bytes, and type says what its type is, a standard MIME type.

The url must be an http url.

<enclosure url="http://www.scripting.com/mp3s/weatherReportSuite.mp3" length="12216320" type="audio/mpeg" />

7 Mar 06, 2011 16:06

Change in /inc/files/items/_item.class.php function get_images()

                        if ( $format == 'enclosure' )
                        {
                            $r .= '<enclosure url="'. $File->get_url(). '" length="' . $File->get_size() . '" type="' . $File->get_Filetype() . '" />';
                            $format = 'entityencoded';
                        }
                        else
                        {
			                    // Generate the IMG tag with all the alt, title and desc if available
			                   $r .= $File->get_tag( $params['before_image'], $params['before_image_legend'], $params['after_image_legend'], $params['after_image'], $params['image_size'], $link_to );
                        }
		}

Change in /skins/_rss2/index.main.php

			// Display images that are linked to this post:
				$content = $Item->get_images( array(
						'before' =>              '<div>',
						'before_image' =>        '<div>',
						'before_image_legend' => '<div><i>',
						'after_image_legend' =>  '</i></div>',
						'after_image' =>         '</div>',
						'after' =>               '</div>',
						'image_size' =>          $image_size,
					), 'enclosure' );

I wasn't able to test any of this. Be aware and make backups of files you are about to change.
I'm not sure what $File->get_Filetype will output. If it's not the mimetype but the file extension alter the type accordingly. Should be like

type="image/png"

8 Mar 07, 2011 02:47

Getting the following error message in my servers php log:

[06-Mar-2011 18:31:33] PHP Notice: Undefined variable: image_size in /public_html/blogs/skins/_rss2/index.main.php on line 179

Also, couldn't find _item.class.php at the path you described. Found it in /inc/items/model

Is that the correct one?

Thanks

9 Mar 07, 2011 03:46

I'm using code from from v 4.0.3. Are you using the same version?
The $image_size is not edited by me . You can leave it blank. It isn't used anymore when generatin enclosures.
Leaving it out simply by removing that line (the last line of the array in the above code.

Remind that I am currently not able to actually test this code.

10 Mar 13, 2011 02:57

OK, I upgraded to 4.0.3 to ensure I am using the same version.

That solved the error message I was getting, but it doesn't seem to be working. I must admit, the changes you made are somewhat beyond my PHP experience, so I just copied and pasted the best I could.

The path you indicated for the _item.class.php is still different than what I see. I found that file in inc/items/model, and made the changes there.

I also assume I should add images to posts the way I always have, by using the img tag. To test, I add a new post with an image, and then look at the source of the RSS2 feed, looking for something like

<enclosure url="http://www.waynealumni.org/images/12345.jpg" length="12216320" type="image/jpeg" /> 

Does that make sense?

Thanks

11 Mar 13, 2011 20:14

Tested:
In /inc/files/model/_file.class.php around line 1839 add / change:

	/**
	 * Get block of images linked to the current Item
	 *
	 * @param array of params
	 * @param string Output format, see {@link format_to_output()}
	 */
	function get_images( $params = array(), $format = 'htmlbody', $is_enclosure = false )
	{


', $is_enclosure = false' is added.

In /inc/files/model/_file.class.php around line 1887 add / change:

                        // Generate the IMG tag with all the alt, title and desc if available
                        $r .= $File->get_tag( $params['before_image'], $params['before_image_legend'], $params['after_image_legend'], $params['after_image'], $params['image_size'], $link_to );
                        if ( $is_enclosure )
                        {
                            $r .= '<enclosure url="'. $File->get_url(). '" length="' . $File->get_size() . '" type="' . $File->get_Filetype()->get( 'mimetype' ) . '" />';
                        }


The if block is added

in /skins/rss2/index.main.php add/change (twice, I think you really want the second occurance in or around line 227, but I'm completely unsure. Just test that with RSS Graffity.)

				// Display images that are linked to this post:
				$content = $Item->get_images( array(
						'before' =>              '<div>',
						'before_image' =>        '<div>',
						'before_image_legend' => '<div><i>',
						'after_image_legend' =>  '</i></div>',
						'after_image' =>         '</div>',
						'after' =>               '</div>',
						'image_size' =>          'fit-320x320'
					), 'htmlbody', true );


Only ', true' is added here.

This gives the following in my rss feed:

<div><enclosure url="http://localhost/foppe/b2evolution/blogs/media/shared/global/monument-valley/monuments.jpg?mtime=1222156607" length="98259" type="image/jpeg" /></div>

12 Mar 14, 2011 00:00

Not sure why I'm seeing something different. The /inc/files/model/_file.class.php doesn't have that function at line 1839, or anywhere else.

Also, same thing with the changes you outline at line 1887. I don't see it in that file.

I do see that code in /inc/items/model/_item.class.php at the lines you indicate.

??
I'm running 4.0.3

13 Mar 14, 2011 19:31

Yes it's _item.class.php
My IDE of choice (Netbeans) is uncool. It should display pathnames in the titlebar but it doesn't. So I usuallt have to guess what file I'm working on.

14 Mar 15, 2011 00:22

OK, I thought maybe I was messing up somewhere.

One more thing, do any of your earlier changes (your Mar. 6 post) still apply? Or just the latest changes?

I'm testing it now, but that information might help speed it up.

Thanks

15 Mar 15, 2011 03:43

It's the same idea but during testing I changed my mind (a bit) and came up with a better solution. So pick the latter one *only*.
It should output with an enclosure. I have no idea if that's enough for Graffiti RSS.

16 Mar 16, 2011 23:11

Hmm. Sorry to be a pain, but I can't seem to get the same result. I've double-checked several times to ensure I've made the three changes you've shown, but when I view the source of the feed, I'm not seeing an enclosure.

Were there only the three changes? Here is where I'm checking the source:

view-source:http://www.waynealumni.org/blogs/index.php?blog=2&tempskin=_rss2


Form is loading...