-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Display pictures in twitter feed? #51
Comments
Does this closed issue address your question? |
Thanks for pointing to the thread, but I'm not sure how to incorporate it. For reference, I'm using tweedledee's
? That gives the url. How do I get it to display the image? Thanks for your help. |
Let's give this a shot. Revise Parsed Data in the Individual TweetsReplace this block: if (isset($currentitem['retweeted_status'])) :
$avatar = $currentitem['retweeted_status']['user']['profile_image_url'];
$rt = ' [<em style="font-size:smaller;">Retweeted by ' . $currentitem['user']['screen_name'] . ' <a href=\'http://twitter.com/' . $currentitem['user']['screen_name'] . '\'>@' . $currentitem['user']['screen_name'] . '</a></em>]';
$tweeter = $currentitem['retweeted_status']['user']['screen_name'];
$fullname = $currentitem['retweeted_status']['user']['name'];
$tweetTitle = $currentitem['retweeted_status']['text'];
else :
$avatar = $currentitem['user']['profile_image_url'];
$rt = '';
$tweeter = $currentitem['user']['screen_name'];
$fullname = $currentitem['user']['name'];
$tweetTitle = $currentitem['text'];
endif; with this: if (isset($currentitem['retweeted_status'])) :
$avatar = $currentitem['retweeted_status']['user']['profile_image_url'];
$rt = ' [<em style="font-size:smaller;">Retweeted by ' . $currentitem['user']['screen_name'] . ' <a href=\'http://twitter.com/' . $currentitem['user']['screen_name'] . '\'>@' . $currentitem['user']['screen_name'] . '</a></em>]';
$tweeter = $currentitem['retweeted_status']['user']['screen_name'];
$fullname = $currentitem['retweeted_status']['user']['name'];
$tweetTitle = $currentitem['retweeted_status']['text'];
else :
$avatar = $currentitem['user']['profile_image_url'];
$rt = '';
$tweeter = $currentitem['user']['screen_name'];
$fullname = $currentitem['user']['name'];
$tweetTitle = $currentitem['text'];
if(isset($currentitem['entities']['media'][0]['media_url'])):
$picurl = $currentitem['entities']['media'][0]['media_url'];
endif;
endif; Update CDATA SectionReplace this block: <description>
<![CDATA[
<div style='float:left;margin: 0 6px 6px 0;'>
<a href='https://twitter.com/<?php echo $twitterName ?>/statuses/<?php echo $currentitem['id_str']; ?>' border=0 target='blank'>
<img src='<?php echo $avatar; ?>' border=0 />
</a>
</div>
<strong><?php echo $fullname; ?></strong> <a href='https://twitter.com/<?php echo $tweeter; ?>' target='blank'>@<?php echo $tweeter;?></a><?php echo $rt ?><br />
<?php echo $parsedTweet; ?>
]]>
</description> with this: <description>
<![CDATA[
<div style='float:left;margin: 0 6px 6px 0;'>
<a href='https://twitter.com/<?php echo $twitterName ?>/statuses/<?php echo $currentitem['id_str']; ?>' border=0 target='blank'>
<img src='<?php echo $avatar; ?>' border=0 />
</a>
</div>
<strong><?php echo $fullname; ?></strong> <a href='https://twitter.com/<?php echo $tweeter; ?>' target='blank'>@<?php echo $tweeter;?></a><?php echo $rt ?><br />
<?php echo $parsedTweet; ?>
if(isset($currentitem['entities']['media'][0]['media_url'])):
<img src='<?php echo $picurl; ?>' border=0 />
endif;
]]>
</description> |
Thanks Chris. I made the modifications. For tweets with images, it does display the image. However, the
As a matter of fact, this line gets pasted in all tweets, even if there is no image. |
My fault. We are rendering raw php. It's been awhile since I tackled any PHP code. For the second codeblock, try this instead: <description>
<![CDATA[
<div style='float:left;margin: 0 6px 6px 0;'>
<a href='https://twitter.com/<?php echo $twitterName ?>/statuses/<?php echo $currentitem['id_str']; ?>' border=0 target='blank'>
<img src='<?php echo $avatar; ?>' border=0 />
</a>
</div>
<strong><?php echo $fullname; ?></strong> <a href='https://twitter.com/<?php echo $tweeter; ?>' target='blank'>@<?php echo $tweeter;?></a><?php echo $rt ?><br />
<?php echo $parsedTweet; ?>
<?php if(isset($currentitem['entities']['media'][0]['media_url'])):
<img src='<?php echo $picurl; ?>' border=0 />
endif; ?>
]]>
</description> Note that we are wrapping the if(isset... in php tags. Let me know if this does the trick. |
No worries. I inspected the code and modified it as:
which worked for me. Will you be rolling this into all the php files in |
How are you reading the RSS feed? Mind verifying that there are no issues in those tweets without images? Let's consider merging this in for everyone. Welcome to pull request it if you would like to contribute it. |
I'm using tiny tiny RSS to read the feed. Yes, tweets without image works fine. I've never done a pull request, but I'll give it a try, perhaps later this week? Thanks for your help. |
Is this your first contribution to an open source project? If so, that is fantastic! If you're interested let's definitely get you through your first pull request so that you can see how simple it is to participate in collaborative development. Do you know how to use git? |
I know the basics of git. I've contributed to open source projects via diff files or describing changes via text, just never via a pull request. I think I could figure it out ;) |
Look forward to it! |
OK, I modified 10 files of the form |
@vinhdizzo Merged and added you to the contributors list on the home page of our documentation: http://chrissimpkins.github.io/tweetledee/index.html Thanks for this PR! When/if I get around to modifying the variables, I will poke you to see if you are still interested in testing it. This will work just fine for now. |
Hi,
Is there an option to display pictures as opposed to the twitter url to the picture in the twitter feed generated by tweetledee? Thanks.
The text was updated successfully, but these errors were encountered: