<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>A Tasty Pixel » Blog &#187; Twitter</title>
	<atom:link href="http://atastypixel.com/blog/tag/twitter/feed/" rel="self" type="application/rss+xml" />
	<link>http://atastypixel.com/blog</link>
	<description></description>
	<lastBuildDate>Mon, 06 Feb 2012 15:08:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Twitter Image Host 2</title>
		<link>http://atastypixel.com/blog/wordpress/plugins/twitter-image-host-2/</link>
		<comments>http://atastypixel.com/blog/wordpress/plugins/twitter-image-host-2/#comments</comments>
		<pubDate>Mon, 06 Feb 2012 12:35:38 +0000</pubDate>
		<dc:creator>Michael Tyson</dc:creator>
				<category><![CDATA[Geekspeak]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Plugins]]></category>

		<guid isPermaLink="false">http://atastypixel.com/blog/?p=2415</guid>
		<description><![CDATA[This is Twitter Image Host 2, the new version of my WordPress Twitter image hosting plugin. Version 2 has been rewritten to store posted images as actual WordPress posts, making it easier to customise how they are displayed. Keep your traffic in the family! Host Twitter images on your own site. Image posting on Twitter [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><small><em>This is Twitter Image Host 2, the new version of my WordPress Twitter image hosting plugin. Version 2 has been rewritten to store posted images as actual WordPress posts, making it easier to customise how they are displayed.</em></small></p>

<p><img src="http://atastypixel.com/blog/wp-content/uploads/2012/02/twitter-image-host-2.jpg" alt="Twitter image host 2" title="twitter-image-host-2.jpg" border="0" width="454" height="302" style="display: block; margin: 0 auto;" class="aligncenter" /></p>

<p><strong>Keep your traffic in the family!  Host Twitter images on your own site.</strong></p>

<p>Image posting on Twitter works by hosting the image somewhere (either on Twitter&#8217;s image service, or another service like Twitpic, img.ly, etc.). The service hosts the image for us (and we send them our traffic).</p>

<p>Better to take advantage of that traffic, and host images on your own site.  This way, viewers come to your site, instead
of someone else&#8217;s!</p>

<p>In Twitter Image Host 2, images are posted as normal posts, in a category you choose. You can then configure your WordPress installation to display posts in this category as you wish.</p>

<p>Twitter Image Host 2 can be used at the same time as the original Twitter Image Host plugin, so the prior system will still work after updating.</p>

<p>Provides a utility within WordPress admin for posting image content, as well as an API modelled on that of <a href="http://img.ly/pages/API">img.ly</a>,
compatible with TweetBot (for iOS) and any other Twitter clients that speak this protocol and offer configuration of custom image hosting services.</p>

<p></p>

<h2><span id="more-2415"></span>Installation</h2>

<p>Install Twitter Image Host 2 from within WordPress, or:</p>

<ol>
<li>Download from the <a href="http://wordpress.org/extend/plugins/twitter-image-host-2/">WordPress plugins repository</a>.</li>
<li>Unzip the package, and upload <code>twitter-image-host-2</code> to the <code>/wp-content/plugins/</code> directory</li>
</ol>

<p>Then,</p>

<ol>
<li>Activate the plugin through the &#8216;Plugins&#8217; menu in WordPress</li>
<li>Visit the settings page and configure the plugin</li>
<li>Start submitting images &#8211; See the &#8216;Posting Images&#8217; section for more</li>
</ol>

<p>If you find Twitter Image Host useful, please consider buying some great <a href="http://atastypixel.com/products">iOS software</a>. Then tell all your friends, family and pets.</p>

<h2>Posting Images</h2>

<p>To start posting from your WordPress blog, select the &#8220;Twitter Images&#8221; menu item from the &#8220;Posts&#8221; administration section.
Select your image file enter a message, then hit Post, and the image will be uploaded and your message sent to Twitter.</p>

<p>To access this facility from an application, use the access point displayed on the Twitter Image Host options page.</p>

<p>The API is more-or-less the same as that of <a href="http://twitpic.com/api.do">TweetPic</a>, <a href="http://img.ly/pages/API">img.ly</a>, etc.</p>

<p>On iOS at least, the Twitter app no longer supports custom images, but TweetBot does.  You can configure a custom image host within Settings -
enter the API URL as listed on the options page.</p>

<h2>Changelog</h2>

<h3>2.0</h3>

<ul>
<li>Initial release of Version 2, which now stores posted images as actual posts, rather than pseudo-posts.</li>
</ul>
 <img src="http://atastypixel.com/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=2415" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://atastypixel.com/blog/wordpress/plugins/twitter-image-host-2/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Personalising AddThis&#8217;s Tweet Button</title>
		<link>http://atastypixel.com/blog/personalising-addthiss-tweet-button/</link>
		<comments>http://atastypixel.com/blog/personalising-addthiss-tweet-button/#comments</comments>
		<pubDate>Sun, 31 Jul 2011 19:08:55 +0000</pubDate>
		<dc:creator>Michael Tyson</dc:creator>
				<category><![CDATA[Geekspeak]]></category>
		<category><![CDATA[Marketing]]></category>
		<category><![CDATA[Social Media]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Plugins]]></category>

		<guid isPermaLink="false">http://atastypixel.com/blog/?p=2218</guid>
		<description><![CDATA[AddThis is a quite useful WordPress plugin for adding a host of sharing options to your blog posts. By default, the &#8220;Tweet&#8221; button that AddThis provides will append &#8220;via @AddThis&#8221; to the end of tweets, which seems to me a little uncool, given that it&#8217;s your content. So, here&#8217;s a little plugin that lets you [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://wordpress.org/extend/plugins/addthis/">AddThis</a> is a quite useful WordPress plugin for adding a host of sharing options to your blog posts.</p>

<p>By default, the &#8220;Tweet&#8221; button that AddThis provides will append &#8220;<em>via @AddThis</em>&#8221; to the end of tweets, which seems to me a little uncool, given that it&#8217;s your content.</p>

<p>So, here&#8217;s a little plugin that lets you specify your own Twitter account name instead of @AddThis.</p>

<p>The principle is simple: AddThis were kind enough to define their own filter for the plugin&#8217;s output.  The plugin plugs itself into this filter, and makes an adjustment to the Tweet button.</p>

<p>To use it, put <code>addthis-modifier.php</code> into your <code>wp-content/plugins</code> folder, open it up and set your twitter name where indicated.  Activate it, and you should be good to go.</p>

<p>Download the plugin: <a href="http://atastypixel.com/blog/wp-content/uploads/2011/07/addthis-modifier.php_1.zip" title="addthis-modifier.php.zip" alt="AddThis Modifier Plugin">AddThis Modifier Plugin</a></p>

<p>For extra marks:  Here&#8217;s some code you can use to replace line 14 (the <em>$twittername = …</em> line) to provide a <em>different Twitter account for each post author</em>.  Is that not awesome?:</p>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000088;">$accounts</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Michael'</span>   <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'MichaelTyson'</span><span style="color: #339933;">,</span>
                      <span style="color: #0000ff;">'Katherine'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'NellieWindmill'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$twittername</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$accounts</span><span style="color: #009900;">&#91;</span>get_the_author<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></pre></div></div>

 <img src="http://atastypixel.com/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=2218" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://atastypixel.com/blog/personalising-addthiss-tweet-button/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Links for May 30th through August 8th</title>
		<link>http://atastypixel.com/blog/links-may-30th-august-8th/</link>
		<comments>http://atastypixel.com/blog/links-may-30th-august-8th/#comments</comments>
		<pubDate>Sun, 08 Aug 2010 22:00:37 +0000</pubDate>
		<dc:creator>Michael Tyson</dc:creator>
				<category><![CDATA[Geekspeak]]></category>
		<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Fonts]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Links]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://atastypixel.com/blog/?p=1921</guid>
		<description><![CDATA[Links for May 30th through August 8th: cuf&#243;n &#8211; fonts for the people A very impressive framework that embeds any font into a website, via javascript and the canvas element. Great cross-browser support. mikeash.com: Method Replacement for Fun and Profit Method replacement and method swizzling in Objective-C. Core Data Tutorial: How To Use NSFetchedResultsController &#124; [...]]]></description>
			<content:encoded><![CDATA[<p>Links for May 30th through August 8th:</p>

<ul class="delicious-bookmarks">
<li><a href="http://cufon.shoqolate.com/generate/">cuf&oacute;n &#8211; fonts for the people</a> A very impressive framework that embeds any font into a website, via javascript and the canvas element. Great cross-browser support.</li>
<li><a href="http://www.mikeash.com/pyblog/friday-qa-2010-01-29-method-replacement-for-fun-and-profit.html">mikeash.com: Method Replacement for Fun and Profit</a> Method replacement and method swizzling in Objective-C.</li>
<li><a href="http://www.raywenderlich.com/999/core-data-tutorial-how-to-use-nsfetchedresultscontroller">Core Data Tutorial: How To Use NSFetchedResultsController | Ray Wenderlich</a> </li>
<li><a href="http://github.com/akosma/TwitThis">TwitThis &ndash; Use Multiple Twitter Clients on your iPhone Application</a> The class TwitterClientManager loads a list list of supported Twitter clients is loaded from a plist file, which can be extended to support more clients in the future;<br />
Each Twitter client is represented by an instance of the TwitterClient class;<br />
The user can choose his preferred Twitter client at any time, and launch the application by a simple touch; the TwitterClientManager class stores the selected value in the user settings.</li>

</ul>
 <img src="http://atastypixel.com/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=1921" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://atastypixel.com/blog/links-may-30th-august-8th/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Twitter Image Host for WordPress</title>
		<link>http://atastypixel.com/blog/wordpress/plugins/twitter-image-host/</link>
		<comments>http://atastypixel.com/blog/wordpress/plugins/twitter-image-host/#comments</comments>
		<pubDate>Sat, 09 Jan 2010 13:44:58 +0000</pubDate>
		<dc:creator>Michael Tyson</dc:creator>
				<category><![CDATA[Geekspeak]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Plugins]]></category>

		<guid isPermaLink="false">http://atastypixel.com/blog/2010/01/09/twitter-image-host-for-wordpress/</guid>
		<description><![CDATA[See the new version, Twitter Image Host 2, which stores images as actual WordPress posts, for more easy customisation and management. It can be run at the same time as Twitter Image Host, for easy migration. Keep your traffic in the family! Host Twitter images on your own site, with support for comments and trackbacks, [...]]]></description>
			<content:encoded><![CDATA[<p><strong>See the new version, <a href="http://atastypixel.com/blog/wordpress/plugins/twitter-image-host-2/">Twitter Image Host 2</a>, which stores images as actual WordPress posts, for more easy customisation and management.  It can be run at the same time as Twitter Image Host, for easy migration.</strong></p>

<p><img src="http://atastypixel.com/blog/wp-content/uploads/2011/08/twitter-image-host.jpg" alt="Twitter image host" title="twitter-image-host.jpg" border="0" width="360" height="222" style="float:right;" class="alignright" />Keep your traffic in the family!  Host Twitter images on your own site, with support for comments and trackbacks, image
resizing and thumbnailing with Lightbox.</p>

<p>Twitter doesn’t yet come with its own inline image support, so we tend to be limited to using image hosting services, 
and linking to them with short URLs. So, services like Twitpic host the image, and we direct traffic to them in return.</p>

<p>Better to take advantage of that traffic, and host images on your own site.  This way, viewers come to your site, instead
of someone else&#8217;s!</p>

<p>Posted images are displayed in your normal WordPress template, with support for comments and trackbacks, without any 
setup required.  Most themes should work with this, but if not, or if a different layout is required, a custom theme template 
can also be provided (see &#8216;Creating a Template&#8217;).</p>

<p>Provides an HTML form for posting image content, as well as an API modelled on that of <a href="http://img.ly/pages/API">img.ly</a>,
compatible with Tweetie (for iPhone) and any other Twitter clients that speak this protocol and offer configuration of
custom image hosting services.</p>

<p>Uses Twitter&#8217;s authentication and a list of authorised accounts, so you can let others use your image host too.  You can even 
post status updates to Twitter while submitting images.</p>

<p>Provides a widget and shortcode to display uploaded images.  This supports filtering by Twitter account, styling with CSS,
and Lightbox/Thickbox.<span id="more-1776"></span>## Download</p>

<p>Download the plugin at <a href="http://wordpress.org/extend/plugins/twitter-image-host/">WordPress&#8217;s plugin directory</a></p>

<p>If you like Twitter Image Host, please consider buying some <a href="http://atastypixel.com/products">awesome Mac/iPhone software</a>.  Then tell all your friends.</p>

<h2>Installation</h2>

<ol>
<li>Unzip the package, and upload <code>twitter-image-host</code> to the <code>/wp-content/plugins/</code> directory</li>
<li>Activate the plugin through the &#8216;Plugins&#8217; menu in WordPress</li>
<li>Visit the settings page and add your Twitter account to the list of authorised accounts</li>
<li>Start submitting images &#8211; See the &#8216;Posting Images&#8217; section for more</li>
</ol>

<h2>FAQ</h2>

<h3>I get &#8220;Couldn&#8217;t place uploaded file&#8221; messages</h3>

<p>You probably need to create the folder in which Twitter Image Host stores uploaded images &#8212; it will try to create the folder automatically, but it will fail if it doesn&#8217;t have permission.</p>

<p>Create a folder called <code>twitter-image-host-content</code> within the <code>wp-content</code> folder of your WordPress installation, and make sure it has write permission for the web server user.</p>

<h3>I keep getting 404 errors</h3>

<p>Make sure your blog is using URL rewriting (i.e. your permalink structure is anything but the boring default <code>?p=###</code>).</p>

<h2>Widget</h2>

<p>To use the widget, simply visit the Widgets page and drag the &#8220;Twitter Images&#8221; widget into a sidebar and configure it.</p>

<h2>Shortcode</h2>

<p>Shortcodes are snippets of text that can be inserted into pages and posts.  These snippets are replaced by various generated content.
Twitter Image Host provides a &#8216;twitter-images&#8217; shortcode to display images you have uploaded within a page/post.</p>

<p>Available parameters:</p>

<table>
<tr><td><tt> count                   </tt></td><td> Number of items to display                                                                          </td></tr>
<tr><td><tt> id                      </tt></td><td> Single ID (eg &#8216;abcde&#8217;) of one image to display, or multiple IDs separated by commas (abcde,fghij)   </td></tr>
<tr><td><tt> view                    </tt></td><td> Image thumbnail view: squares, proportional, large or custom                                        </td></tr>
<tr><td><tt> custom_thumbnail_width  </tt></td><td> Custom width for thumbnails, when &#8216;view&#8217; is &#8216;custom&#8217;                                                </td></tr>
<tr><td><tt> custom_thumbnail_height </tt></td><td> Custom width for thumbnails, when &#8216;view&#8217; is &#8216;custom&#8217;                                                </td></tr>
<tr><td><tt> custom_thumbnail_crop   </tt></td><td> Whether to crop custom thumbnails                                                                   </td></tr>
<tr><td><tt> author                  </tt></td><td> Comma-separated list of Twitter account names to limit results to                                   </td></tr>
<tr><td><tt> columns                 </tt></td><td> Number of columns of images to display                                                              </td></tr>
<tr><td><tt> lightbox                </tt></td><td> &#8216;true&#8217; to use Lightbox/Thickbox                                                                     </td></tr>
</table>

<p>Example (square brackets replaced by curly brackets):</p>

<pre><code>  {twitter-images columns=4 lightbox="true"}
</code></pre>

<h2>PHP function</h2>

<p>As well as the shortcode, you can also use call <code>twitter_image_host_images()</code> from within a template to
produce the same output.  Pass the same arguments as the shortcode as associative array values:</p>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;h3&gt;Recently submitted images&lt;/h3&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> twitter_image_host_images<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'author'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'ATastyPixel'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'columns'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">6</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'lightbox'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>


<p>Tip: Use this in the <code>twitter-image-host.php</code> template (see &#8216;Creating a Single Template&#8217;, below) to display
other posted images when viewing an image.  Use <code>the_twitter_image_author()</code> to filter the list, to show
only other submissions by the same Twitter account as the one of the currently displayed image.</p>

<h2>Template Tags</h2>

<p>This plugin provides several template tags, for use both in displaying single posts (see &#8216;Creating a Single Template&#8217;), and for custom pages which display
many posts in a loop (see &#8216;Using Template Tags in a Loop&#8217;).</p>

<p>The available template tags are:</p>

<h3>Single Entry Tags</h3>

<p><em><code>the_twitter_image_permalink</code></em></p>

<p>Returns the URL to the view page</p>

<p><em><code>the_twitter_image_url</code></em></p>

<p>Returns the full URL to the image, or the image thumbnail if the original image was large</p>

<p><em><code>the_twitter_full_image_url</code></em></p>

<p>Returns the URL to the full-sized image, if one exists, or false otherwise</p>

<p><em><code>the_twitter_image_title</code></em></p>

<p>The title of the image</p>

<p><em><code>the_twitter_image_date</code></em></p>

<p>The date (timestamp) of the image &#8211; use date() to configure the display</p>

<p><em><code>the_twitter_image_author</code></em></p>

<p>The associated Twitter account</p>

<p><em><code>the_twitter_image</code></em></p>

<p>Returns HTML to display the image and a link to the full-sized image if it exists, with Lightbox rel tags.</p>

<h3>Loop Tags</h3>

<p><em><code>query_twitter_images</code></em></p>

<p>Search for Twitter images</p>

<p>Available parameters (passed as associative array):</p>

<table>
<tr><td><tt>     count         </tt></td><td>           Number of items to display                                                                            </td></tr>
<tr><td><tt>     id            </tt></td><td>           Single ID (eg &#8216;abcde&#8217;) of one image to display, or multiple IDs separated by commas (abcde,fghij)     </td></tr>
<tr><td><tt>     author        </tt></td><td>           Comma-separated list of Twitter account names to limit results to                                     </td></tr>
</table>

<p><em><code>has_twitter_images</code></em></p>

<p>Use with loop: Determine if there are more images</p>

<p><em><code>next_twitter_image</code></em></p>

<p>Use with loop: Get the next image</p>

<h3>Creating a Single Template</h3>

<p>By default, this plugin will use the standard post template (&#8216;single.php&#8217;).  However, if you wish, you can create a 
custom template to display hosted images.  The template should be called &#8216;twitter-image-host.php&#8217;, located within your
current theme directory.</p>

<p>Creating a template to use this information is fairly straightforward if you have just a little knowledge of HTML or PHP:</p>

<ul>
<li>On your server (via an FTP program, etc.), navigate to your current theme.  This will live within <code>wp-content/themes</code>.</li>
<li>Copy an existing template &#8211; <code>single.php</code> is usually a good candidate &#8211; and call it <code>twitter-image-host.php</code>.</li>
<li>Open up <code>twitter-image-host.php</code>, and delete everything that looks post-related: This usually includes everything between
the <code>have_posts</code> call and the matching <code>endif</code>, and may include some other surrounding content like an &#8216;Edit this post&#8217; link.</li>
<li>Replace that which you have just deleted with something that uses the &#8216;single entry&#8217; template tags above, like the following:</li>
</ul>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> the_twitter_image<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;h1 class=&quot;center&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> the_twitter_image_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/h1&gt;
&lt;p class=&quot;center&quot;&gt;
	From &lt;a href=&quot;http://twitter.com/<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> the_twitter_image_author<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> the_twitter_image_author<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt;
	 on <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'F jS, Y'</span><span style="color: #339933;">,</span> the_twitter_image_date<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/p&gt;</pre></div></div>


<ul>
<li>Save the file, add some content (see the &#8216;Posting Images&#8217; section), and see how it looks.</li>
</ul>

<h3>Using Template Tags in a Loop</h3>

<p>Just like the WordPress Loop template tags, the template tags provided by this plugin can be used to display multiple posted entries.
This can be used to create a custom page template that lists all submitted entries, with more flexibility than that offered by the shortcode.</p>

<p>Use begins with a call to <code>query_twitter_images()</code>, possibly with an argument to configure the search.  If the result is true, then the loop begins,
conditional upon <code>has_twitter_images()</code>, and starting with <code>next_twitter_image()</code> to load the next entry.  The single template tags can then be used
to customise the display of each entry.</p>

<p>Here is an example of use:</p>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> query_twitter_images<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
    <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span> has_twitter_images<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> next_twitter_image<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
        &lt;div class=&quot;item entry&quot;&gt;
          &lt;div class=&quot;itemhead&quot;&gt;
            &lt;h1&gt;&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> the_twitter_image_permalink<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; rel=&quot;bookmark&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> the_twitter_image_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt;&lt;/h1&gt;
            &lt;div class=&quot;date&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'F jS, Y'</span><span style="color: #339933;">,</span> the_twitter_image_date<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/div&gt;
          &lt;/div&gt;
&nbsp;
          <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> the_twitter_image<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
          &lt;p class=&quot;center&quot;&gt;From &lt;a href=&quot;http://twitter.com/<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> the_twitter_image_author<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> the_twitter_image_author<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt;&lt;/p&gt;
          &lt;/div&gt;
    <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endwhile</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">else</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
    &lt;p&gt;There are no Twitter images.&lt;/p&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>


<h2>Posting Images</h2>

<p>To start posting from your WordPress blog, select the &#8220;Twitter Image Host&#8221; menu item from the &#8220;Posts&#8221; administration section.
Enter a title for your image, select your image file, hit Submit, and you will be given the URL for the image.  If you wish
to tweet straight from this facility, you will need to follow the instructions from that page to set up the plugin.</p>

<p>To access this facility from an application, use the access point displayed on the Twitter Image Host options page under &#8220;Settings&#8221;.</p>

<p>The API is more-or-less the same as that of <a href="http://twitpic.com/api.do">TweetPic</a>, <a href="http://img.ly/pages/API">img.ly</a>, etc.</p>

<p>To post from Twitter (Tweetie 2) for iPhone, visit Twitter/Tweetie&#8217;s settings, and within <em>Services, Image Service</em>, select &#8216;Custom&#8217;, then
enter the API URL as listed on the options page.</p>

<h2>Making the URL even shorter</h2>

<p>If you run WordPress from a sub-directory (for example, http://your-site.com/blog), then the short URLs generated by this plugin will
look like http://your-site/blog/xxxxx.  You can remove that &#8216;blog&#8217; component via a little <code>.htaccess</code> trickery.</p>

<p>Here&#8217;s how:</p>

<ol>
<li>Create and open a new file in your site&#8217;s webroot called &#8220;.htaccess&#8221;. If there&#8217;s one already there, just open that up and prepare to edit at the bottom.</li>
<li><p>Add the following, replacing &#8216;blog&#8217; with the real subdirectory under which WordPress is installed:</p>

<pre><code>&lt;IfModule mod_rewrite.c&gt;
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/([^/]+)/?$
RewriteCond %{DOCUMENT_ROOT}/blog/wp-content/twitter-image-host-content/%1.jpg -f [OR]
RewriteCond %{DOCUMENT_ROOT}/blog/wp-content/twitter-image-host-content/%1.png -f [OR]
RewriteCond %{DOCUMENT_ROOT}/blog/wp-content/twitter-image-host-content/%1.jpeg -f
RewriteRule (.*) /blog/$1 [L]
&lt;/IfModule&gt;
</code></pre>

<p>This will take any requests that:</p>

<ul>
<li>Are located in the web-root (start with a slash, followed by anything but a slash until the end)</li>
<li>Have a corresponding file within Twitter Image Host&#8217;s content directory
Then, it&#8217;ll rewrite the request silently to the real Twitter Image Host URL, without the viewer seeing.</li>
</ul></li>
<li><p>In Twitter Image Host settings, set the &#8216;Override URL Prefix&#8217; option to &#8216;http://your-site.com/&#8217;</p></li>
</ol>
 <img src="http://atastypixel.com/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=1776" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://atastypixel.com/blog/wordpress/plugins/twitter-image-host/feed/</wfw:commentRss>
		<slash:comments>174</slash:comments>
		</item>
		<item>
		<title>DIY Twitter image hosting</title>
		<link>http://atastypixel.com/blog/diy-twitter-image-hosting/</link>
		<comments>http://atastypixel.com/blog/diy-twitter-image-hosting/#comments</comments>
		<pubDate>Thu, 07 Jan 2010 14:16:07 +0000</pubDate>
		<dc:creator>Michael Tyson</dc:creator>
				<category><![CDATA[Geekspeak]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Workflow]]></category>

		<guid isPermaLink="false">http://atastypixel.com/blog/?p=1757</guid>
		<description><![CDATA[Twitter doesn&#8217;t yet come with its own inline image support, so we tend to be limited to using image hosting services, and linking to them with short URLs. So, services like Tweetpic host the image, and we direct traffic to them in return. Thinking it&#8217;s better to keep things in the family, and take better [...]]]></description>
			<content:encoded><![CDATA[<p>Twitter doesn&#8217;t yet come with its own inline image support, so we tend to be limited to using image hosting services, and linking to them with short URLs.  So, services like Tweetpic host the image, and we direct traffic to them in return.</p>

<p>Thinking it&#8217;s better to keep things in the family, and take better advantage of that traffic, I put together an image hosting setup of my own.  Now viewers come to my own site, instead of someone else&#8217;s!</p>

<p>It looks like <a href="http://twitter.com/ATastyPixel/status/7478572775">this</a></p>

<p>The setup consists of an Automator service, and some PHP smarts on the site.</p>

<p><img src="http://atastypixel.com/blog/wp-content/uploads/2010/01/201001071440.jpg" width="200" height="70" alt="Send Image to Image Hosting" class="alignright polaroid rotation" />Under Snow Leopard, I can right-click on an image in Finder, click &#8216;Send Image to Image Hosting&#8217;, type in a title,  then paste the URL that&#8217;s automatically been put onto my clipboard into a tweet.</p>

<p>Here&#8217;s how it works &#8211; this assumes a moderate level of understanding of PHP and assorted web administration.<span id="more-1757"></span>
<em>Update</em>: I couldn&#8217;t help myself; I made a <a href="http://atastypixel.com/blog/wordpress/plugins/twitter-image-host">WordPress plugin</a> for this, with some extra nice features.</p>

<h2>Presentation</h2>

<p>First, we need to put together a script that will display the image.  What&#8217;s more, it would be nice to give the image a title, and link it back to the Twitter account.</p>

<p>So, we&#8217;ll want a place to put images, and a way to store the corresponding title and account name.</p>

<p>I opted to store the latter in a file alongside the image called <code>(imagename).meta</code>.  I store the title, then a newline, then the Twitter account name.</p>

<p>Lets create <code>image.php</code> &#8212; it should take an <code>image name</code> parameter, excluding the file extension, and display the corresponding image, with any corresponding meta data.</p>

<p>Here&#8217;s a sample:</p>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$MEDIA_DIR</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;twitter-images&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Get the image name, but avoid any path shenanigans by just grabbing the 'basename' of the file</span>
<span style="color: #000088;">$image</span> <span style="color: #339933;">=</span> <span style="color: #990000;">basename</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Make sure it exists, or report a 404 error</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><span style="color: #000088;">$image</span> <span style="color: #339933;">||</span> <span style="color: #339933;">!</span><span style="color: #990000;">is_file</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$MEDIA_DIR</span>/<span style="color: #006699; font-weight: bold;">$image</span>.jpg&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;404.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Grab the meta data</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">file_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$MEDIA_DIR</span>/<span style="color: #006699; font-weight: bold;">$image</span>.meta&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #990000;">list</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$title</span><span style="color: #339933;">,</span> <span style="color: #000088;">$source</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$MEDIA_DIR</span>/<span style="color: #006699; font-weight: bold;">$image</span>.meta&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Set a default title if we don't have any meta data</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><span style="color: #000088;">$title</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$title</span> <span style="color: #339933;">=</span> <span style="color: #990000;">ucwords</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">strtolower</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$image</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Include the page header, if you like</span>
<span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;header.inc.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&lt;div class=&quot;content&quot;&gt;
&nbsp;
    &lt;img src=&quot;/<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> MEDIA_DIR <span style="color: #000000; font-weight: bold;">?&gt;</span>/<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$image</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>.jpg&quot; alt=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #990000;">htmlspecialchars</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$title</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; class=&quot;image&quot; /&gt;
&nbsp;
    &lt;h1&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$title</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/h1&gt;
&nbsp;
    <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$source</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
        &lt;p&gt;
            From &lt;a href=&quot;http://twitter.com/<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$source</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;
                &lt;img src=&quot;/media/images/twitter.png&quot; width=&quot;14&quot; height=&quot;14&quot; alt=&quot;Follow us on Twitter!&quot;&gt;
                <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$source</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
            &lt;/a&gt;
        &lt;/p&gt;
    <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&lt;/div&gt;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;footer.inc.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>


<p>Make sure it works by making a sample image called, say, <code>IMG.jpg</code>, and an accompanying metadata file, called <code>IMG.meta</code> with a title on the first line and a twitter account name on the second, and opening up <code>http://yoursite.com/image.php?name=IMG</code></p>

<p>Now, we want to keep URLs short, so they don&#8217;t take up too much valuable space in a tweet, so we need to use some tricks here.</p>

<p>We&#8217;ll set up a <code>.htaccess</code> file that uses <code>mod_rewrite</code> to keep the URL short.</p>

<p>Something like this should do the trick:</p>

<blockquote>
<pre>
&lt;IfModule mod_rewrite.c&gt;
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/([^/]+)$
RewriteCond %{DOCUMENT_ROOT}/twitter-images/%1.jpg -f
RewriteRule (.*) /image.php?name=$1 [L]
&lt;/IfModule&gt;
</pre>
</blockquote>

<p>Note on the fifth line we are checking inside our Twitter images folder &#8212; make sure that matches your storage path.</p>

<p>This will take any requests that:</p>

<ul>
<li>Are located in the web-root (<em>start with a slash, followed by anything but a slash until the end</em>)</li>
<li>Have a corresponding file within the directory we&#8217;ll store images in</li>
</ul>

<p>Then, it&#8217;ll rewrite the request silently to use <code>image.php</code>.</p>

<p>Save the <code>.htaccess</code> file, and open <code>http://yoursite.com/IMG</code>.  It should bring up the image, just as before.</p>

<p>Set up some CSS to make it look good, and you&#8217;re set.  Here&#8217;s mine:</p>


<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">&nbsp;
<span style="color: #808080; font-style: italic;">/* @group Twitter images */</span>
&nbsp;
<span style="color: #6666ff;">.twitter-image</span> .<span style="color: #000000; font-weight: bold;">content</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">margin-top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">50px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin-bottom</span><span style="color: #00AA00;">:</span> <span style="color: #933;">50px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.twitter-image</span> .<span style="color: #000000; font-weight: bold;">content</span> img<span style="color: #6666ff;">.image</span> <span style="color: #00AA00;">&#123;</span>
	-moz-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
	-webkit-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#f1f1f1</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#aaa</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span>  <span style="color: #933;">40px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin-right</span><span style="color: #00AA00;">:</span> <span style="color: #933;">60px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.twitter-image</span> .<span style="color: #000000; font-weight: bold;">content</span> h1 <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">padding-top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">60px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.twitter-image</span> .<span style="color: #000000; font-weight: bold;">content</span> p <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.twitter-image</span> .<span style="color: #000000; font-weight: bold;">content</span> a <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.twitter-image</span> .<span style="color: #000000; font-weight: bold;">content</span> a img <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">vertical-align</span><span style="color: #00AA00;">:</span>text-<span style="color: #000000; font-weight: bold;">bottom</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* @end */</span></pre></div></div>


<h2>Automator</h2>

<p>Now, with the web side set up, we need to set up an easy way to send content there.</p>

<p>I opted for an Automator service, which uses <code>scp</code> to upload the content.  If your web host doesn&#8217;t provide for <code>scp</code>, you may want to use something else like <a href="http://www.ncftp.com/download/">ncftpput</a>, or even an Applescript-able application.  You&#8217;ll need to modify the Automator action&#8217;s shell script accordingly.</p>

<p>Here&#8217;s the Automator service I set up: <a href="http://atastypixel.com/blog/wp-content/uploads/2010/01/Send-Image-to-Image-Hosting.zip" title="Send Image to Image Hosting.zip">Send Image to Image Hosting.zip</a>.</p>

<p>For those interested, it contains the following shell script:</p>


<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">APPSUPPORT=~/&quot;Library/Application Support/Image Hosting&quot;
TMPDIR='/tmp/image-hosting.tmp'
DEST='me@mywebsite.com:www/mywebsite/twitter-images/'
URLPREFIX='http://mywebsite.com/'
UPLOADRETRIES=3
# GROWL=&quot;/usr/local/bin/growlnotify&quot; # Uncomment this if you have Growl and growlnotify
&nbsp;
[ ! -e &quot;$APPSUPPORT&quot; ] &amp;&amp; mkdir &quot;$APPSUPPORT&quot;
&nbsp;
for f in &quot;$@&quot;
do
  if [ ! -e &quot;$f&quot; ]; then
    osascript -e 'tell application &quot;Finder&quot;' -e 'activate' -e 'display dialog &quot;Input file '&quot;$f&quot;' does not exist&quot; with title &quot;Image Hosting&quot; buttons {&quot;OK&quot;} with icon Stop' -e 'end tell'
    exit
  fi
&nbsp;
  # Generate random name
  while true; do
      name=`perl -e 'use MIME::Base64; $s=encode_base64(rand()); $s =~ s/=|\n//g; $s = substr($s, -5); print $s'`
      if ! grep &quot;$name&quot; &quot;$APPSUPPORT/Taken Names&quot; &amp;&gt;/dev/null; then break; fi;
  done;
&nbsp;
  # Gather info
  default=`php -r '$s = basename(&quot;'&quot;$f&quot;'&quot;); echo ucwords(strtolower(substr($s, 0, strpos($s, &quot;.&quot;))));'`
  title=`osascript -e 'tell application &quot;Finder&quot;' -e 'activate' -e 'text returned of (display dialog &quot;Enter image title&quot; with title &quot;Image Hosting&quot; default answer &quot;'&quot;$default&quot;'&quot; buttons {&quot;Cancel&quot;, &quot;Continue&quot;} default button 2)' -e 'end tell'`
  [ ! &quot;$title&quot; ] &amp;&amp; exit
  defaulttwitter=`cat &quot;$APPSUPPORT/Default Twitter Account&quot; 2&gt;/dev/null`
  twitter=`osascript -e 'tell application &quot;Finder&quot;' -e 'activate' -e 'text returned of (display dialog &quot;Enter Twitter account&quot; with title &quot;Image Hosting&quot; default answer &quot;'&quot;$defaulttwitter&quot;'&quot; buttons {&quot;Cancel&quot;, &quot;Continue&quot;} default button 2)' -e 'end tell'`
  [ ! &quot;$twitter&quot; ] &amp;&amp; exit
  echo $twitter &gt; &quot;$APPSUPPORT/Default Twitter Account&quot;
&nbsp;
  # Create temp files
  [ -e &quot;$TMPDIR&quot; ] &amp;&amp; rm -rf &quot;$TMPDIR&quot;
  mkdir &quot;$TMPDIR&quot;
  cp &quot;$f&quot; &quot;$TMPDIR/$name.jpg&quot;
  echo &quot;$title
$twitter&quot; &gt; &quot;$TMPDIR/$name.meta&quot;
&nbsp;
  [ -f &quot;$GROWL&quot; ] &amp;&amp; $GROWL -n 'Image Hosting' &quot;Image Hosting: `basename &quot;$f&quot;`&quot; -m &quot;Image Hosting is uploading '$name'&quot;
&nbsp;
  # Upload
  retries=0
  while [ $retries -lt $UPLOADRETRIES ]; do
    result=`scp &quot;$TMPDIR&quot;/* &quot;$DEST&quot; 2&gt;&amp;1` &amp;&amp; break;
    [ -f &quot;$GROWL&quot; ] &amp;&amp; $GROWL -n &quot;Image Hosting: `basename &quot;$f&quot;`&quot; 'Image Hosting' -m 'Upload failed: Retrying'
    retries=$((retries+1))
  done
&nbsp;
  if [ $retries -ge $UPLOADRETRIES ]; then
    osascript -e 'tell application &quot;Finder&quot;' -e 'activate' -e 'display dialog &quot;Could not upload image.  Scp said: '&quot;$result&quot;'&quot; with title &quot;Image Hosting&quot; with icon Stop' -e 'end tell'
    exit
  fi
&nbsp;
  echo $name &gt;&gt; &quot;$APPSUPPORT/Taken Names&quot;
&nbsp;
  osascript -e 'tell application &quot;Finder&quot; to set the clipboard to &quot;'&quot;$URLPREFIX$name&quot;'&quot;'
&nbsp;
  [ -f &quot;$GROWL&quot; ] &amp;&amp; $GROWL -n 'Image Hosting' &quot;Image Hosting: `basename &quot;$f&quot;`&quot; -m &quot;Upload complete.  Available at $URLPREFIX/$name (copied to clipboard)&quot;
done</pre></div></div>


<p>To use it:</p>

<ol>
<li>Unzip it, </li>
<li>Put it into <code>Library/Services</code>, </li>
<li>Double-click on it to open it in Automator,</li>
<li>Change the settings at the top of the &#8216;Shell Script&#8217; segment &#8212; 

<ul>
<li>Set <code>DEST</code> to the <code>scp</code> destination</li>
<li>Set up <a href="http://www.google.com/search?q=ssh%20authorized_keys">key-based SSH authentication</a>, so you don&#8217;t have to enter the password to upload, or, if you&#8217;d prefer to use something other than <code>scp</code> to upload the file, you can change the upload command further down in the script, underneath the &#8216;Upload&#8217; comment (look for <code>scp</code>)</li>
<li>Set <code>URLPREFIX</code> to <code>http://yoursite.com</code></li>
<li>If you have Growl and <code>growlnotify</code> installed, then set <code>GROWL</code> to the location of <code>growlnotify</code> (highly recommended)</li>
</ul></li>
<li>Save</li>
</ol>

<h2>Usage</h2>

<p>If you&#8217;re using Leopard, you may need to log out, then log back in to see the service &#8212; I&#8217;m not entirely certain.  If you&#8217;re on Snow Leopard, you should hopefully be set.  Right-click on an image file in Finder, and click &#8216;<em>Send Image to Image Hosting</em>&#8216;.</p>

<p>You should be asked for a title, then asked for a Twitter account name (this will be remembered for next time), then the upload will happen, and when it completes, the URL to the uploaded image will be put onto the clipboard so you can paste straight into Twitter.</p>

<p>Voila.</p>
 <img src="http://atastypixel.com/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=1757" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://atastypixel.com/blog/diy-twitter-image-hosting/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Twitter posting lists with images</title>
		<link>http://atastypixel.com/blog/wordpress/plugins/twinkle-twitpic-twitter/</link>
		<comments>http://atastypixel.com/blog/wordpress/plugins/twinkle-twitpic-twitter/#comments</comments>
		<pubDate>Thu, 16 Oct 2008 03:02:29 +0000</pubDate>
		<dc:creator>Michael Tyson</dc:creator>
				<category><![CDATA[Geekspeak]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Plugins]]></category>

		<guid isPermaLink="false">http://atastypixel.com/blog/2008/10/16/twitter-posting-lists-with-images/</guid>
		<description><![CDATA[A Wordpress plugin to display recent Twitter updates, with images from Twinkle or Twitpic displayed inline. Also includes the core PHP class to be used in other systems.]]></description>
			<content:encoded><![CDATA[<p><img class="small" style="float: right;" title="200810161358.jpg" src="http://atastypixel.com/blog/wp-content/uploads/2008/10/200810161358.jpg" alt="200810161358.jpg" width="200" height="196" /></p>

<p><a href="http://atastypixel.com/blog/2008/09/08/adding-twinkle-to-twitter-posting-lists/">Recently</a> I released some code to discover and embed Twinkle images linked from Twitter postings, and released a modification to Ricardo González&#8217;s <a href="http://rick.jinlabs.com/code/twitter/">Twitter for WordPress</a> plugin which uses it.</p>

<p>I&#8217;ve now implemented support for Twitpic as well.</p>

<p>Grab the modified WordPress plugin here:</p>

<p><a href="http://atastypixel.com/blog/wp-content/uploads/2009/09/twitter-for-wordpress-plus-images-v0.2.6.zip" title="twitter-for-wordpress-plus-images-v0.2.6.zip">twitter-for-wordpress-plus-images-v0.2.6.zip</a></p>

<p><em>After installation, add the widget and make sure &#8216;Discover images&#8217; is ticked.</em></p>

<p>For non-Wordpress users, the base code is also available here:</p>

<p><a href="http://atastypixel.com/blog/wp-content/uploads/2009/09/TwitterImageUtil.class.php-v0.2.6.zip" title="TwitterImageUtil.class.php-v0.2.6.zip">TwitterImageUtil.class.php-v0.2.6.zip</a></p>

<p>Include it in your twitter list source code, and use it as a filter for the message content. Something like:</p>

<blockquote style="font-size: 0.8em;"><tt>$message = TwitterImageUtil::processContent($message, $mysql_database_handle);</tt></blockquote>

<p>Some configuration is possible – see the header comments for more details.</p>

<p>The code will create a thumbnail of the image, and store it locally. It&#8217;ll also cache the results in a MySQL database for speed. It supports Lightbox, too – just supply the relevant flag to turn it on.</p>

<h3>Updates</h3>

<ul>
<li>Version 0.2.6: Bugfix for posts with both images and @mentions</li>
<li>Version 0.2.5: Bugfix from prior version, plus compatibility fix for Twitpic changes</li>
<li>Version 0.2.4: Updated to match Twitter for WordPress v1.9.2: Compatibility fix for WP 2.7</li>
<li>Version 0.2.3: Another update, chasing the moving target that is Twitpic</li>
<li>Version 0.2.2: Updated to match Twitpic&#8217;s new image storage using Amazon S3.</li>
</ul>
 <img src="http://atastypixel.com/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=958" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://atastypixel.com/blog/wordpress/plugins/twinkle-twitpic-twitter/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Keeping iChat and Adium status in sync with Twitter</title>
		<link>http://atastypixel.com/blog/keeping-ichat-and-adium-status-in-sync-with-twitter/</link>
		<comments>http://atastypixel.com/blog/keeping-ichat-and-adium-status-in-sync-with-twitter/#comments</comments>
		<pubDate>Fri, 10 Oct 2008 02:39:58 +0000</pubDate>
		<dc:creator>Michael Tyson</dc:creator>
				<category><![CDATA[Geekspeak]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://atastypixel.com/blog/2008/10/10/keeping-ichat-and-adium-status-in-sync-with-twitter/</guid>
		<description><![CDATA[A script which takes the latest tweet from Twitter and sets it as the status message in iChat and/or Adium. Use crontab to run it regularly to stay in sync.]]></description>
			<content:encoded><![CDATA[<p>I’ve been using Twitter for a while now, and I’ve just started doing ‘global’ status updates across Twitter, Facebook, and my instant messenger account statuses for iChat and Adium. Usually I use <a href="http://blog.circlesixdesign.com/download/moodswing/">MoodBlast</a>, a really nice application which lets me use a global keyboard shortcut to quickly enter a tweet and hit enter to update everything simultaneously.</p>

<p>However, if I want to update from, say, <a href="http://tapulous.com/twinkle/">Twinkle</a> on my iPhone (<small>side-note: Wow, Tapulous need to do some serious SEO &#8211; their Twitter site isn’t even on the first page of Google hits. <em>I’m</em> on the first page of Google hits for it, ferchrissake</small>) the sync won’t happen. This Ruby script will do the trick.</p>

<p><span id="more-867"></span>Download: <a href="http://atastypixel.com/blog/wp-content/uploads/2009/03/sync-status-with-twitterrb2.zip" title="sync-status-with-twitter.rb.zip">Sync Status With Twitter</a></p>

<p>To use it:</p>

<ol>
    <li>Extract the <em>.rb</em> file to ~/Library/Scripts</li>
    <li>Open it in, say, TextEdit and edit ‘Username’ at the top of the file to match your username</li>
    <li>Open Terminal (in <em>Applications, Utilities</em>)</li>
    <li>Make the script executable: <tt>chmod +x ~/Library/Scripts/sync-status-with-twitter.rb</tt></li>
    <li>Open your crontab: <tt>crontab -e</tt></li>
    <li>Add a line to crontab to run the script regularly:
<ul>
    <li>Press ‘<tt>o</tt>’ to insert a new line</li>
    <li>Paste the following line:
<blockquote><tt>*/30 * * * * ~/Library/Scripts/sync-status-with-twitter.rb</tt></blockquote>
The ‘30’ here means run every 30 minutes. Change it if you want. Some alternatives are:
<blockquote><tt>*/10 * * * *…</tt> &#8211; Every 10 minutes
<tt>0 * * * *…</tt> &#8211; Hourly, on the hour
<tt>0 */2 * * *…</tt> &#8211; Every second hour, on the hour</blockquote>
</li>
    <li>Press escape to stop editing</li>
    <li>Hold down shift and press ZZ (Z key twice) to save and quit</li>
</ul>
</li>
    <li>You’re done. Wait a little bit and it’ll update, or if you like, run it immediately from Terminal (<tt>~/Library/Scripts/sync-status-with-twitter.rb</tt>).</li>
</ol>

<p>If you want to update Facebook too, you have two options: <del>Either use the excellent Facebook plugin for Adium (comes with the latest version), and it’ll happen all by default</del> [<em><strong>Edit</strong>: Looks like I'm wrong; Adium won't update Facebook</em>] , or add the Twitter application to Facebook itself.</p>

<p>This script was inspired by a <a href="http://railstips.org/2008/5/2/update-your-friends-ichat-status-with-a-twitter-direct-message-simply-because-you-can">similar script by John Nunemaker over at RailsTips.org</a>. Thanks, John.</p>

<p><b>Update:</b> <a href="http://abednarz.net/">Bed</a> has made some changes which will <a href="http://abednarz.net/wp/twitter-adium-status-syncing-ignoring-replies/">ignore @reply messages</a>.</p>

<p><b>Update:</b> I&#8217;ve also added an implementation to ignore @reply messages</p>

<p><b>Update:</b> I&#8217;ve added a provision to only update the status if you&#8217;re not set as away &#8211; if you&#8217;re away, the status message will remain unchanged.</p>
 <img src="http://atastypixel.com/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=867" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://atastypixel.com/blog/keeping-ichat-and-adium-status-in-sync-with-twitter/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
	</channel>
</rss>

