<?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>Marilyn Burgess &#187; Add new tag</title>
	<atom:link href="http://marilynburgess.com/tag/add-new-tag/feed/" rel="self" type="application/rss+xml" />
	<link>http://marilynburgess.com</link>
	<description></description>
	<lastBuildDate>Mon, 29 Aug 2011 16:33:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Share Buttons are SO Easy!!</title>
		<link>http://marilynburgess.com/2009/04/share-buttons-are-so-easy/</link>
		<comments>http://marilynburgess.com/2009/04/share-buttons-are-so-easy/#comments</comments>
		<pubDate>Tue, 14 Apr 2009 19:55:34 +0000</pubDate>
		<dc:creator>marilyn</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Social Networking]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Add new tag]]></category>
		<category><![CDATA[Share]]></category>
		<category><![CDATA[Social media]]></category>

		<guid isPermaLink="false">http://blog.listcentral.me/?p=113</guid>
		<description><![CDATA[The viral aspects of the social web are all the rage these days. If you want traffic, the best and cheapest method to get it is to harness social media sites like Digg, Reddit, StumbleUpon, Twitter, Delicious and Facebook.  Social medial sharing is the new, high tech version of word of mouth. It was a [...]]]></description>
			<content:encoded><![CDATA[<p>The viral aspects of the social web are all the rage these days. If you want traffic, the best and cheapest method to get it is to harness social media sites like <a href="http://digg.com">Digg</a>, <a href="http://reddit.com">Reddit</a>, <a href="http://stumbleupon.com">StumbleUpon</a>, <a href="http://twitter.com">Twitter</a>, <a href="http://delicious.com">Delicious</a> and <a href="http://facebook.com">Facebook</a>.  Social medial sharing is the new, high tech version of word of mouth.</p>
<p>It was a no brainer for me to include share buttons on List Central, to make it easy for my users to spread the word about cool lists that they find. Fortunately, the developers at the big social networking sites have made it easy to add share buttons on your site. It took me less than a couple hours to set up share buttons for my 5 favourite social media site on List Central. The following is a breif summary of how to get going with share buttons for each of the sites I implemented:</p>
<div style="float:left;margin:5px;"><script type="text/javascript"><!--
digg_url = 'http://blog.listcentral.me/2009/03/28/share-buttons-are-so-easyshare-buttons-are-so-easy';
digg_skin = 'icon';
digg_window = 'new';
// --></script><script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></div>
<p><strong>Digg</strong> offers a page full of documentation to help you implement links to digg your stories on their <a href="http://digg.com/tools/integrate">Digg Integrate page</a>. There are two facets to sharing stories on Digg: digging, and submitting a story that hasn&#8217;t previously been submitted. The good people at Digg have put together an easy to install script that figures out whether or not the story has been submitted previously, and takes the user who clicks on the icon to the appropriate place.</p>
<div class="code">
&lt;script type=&#8217;text/javascript&#8217;&gt;<br />
digg_url = &#8216;http://blog.listcentral.me/2009/04/06/share-buttons-are-so-easyshare-buttons-are-so-easy/&#8217;; digg_skin = &#8216;icon&#8217;;<br />
digg_window = &#8216;new&#8217;;<br />
&lt;/script&gt; &lt;script src=&#8217;http://digg.com/tools/diggthis.js&#8217; type=&#8217;text/javascript&#8217;&gt;&lt;/script&gt;
</div>
<p> As the code above illustrates, Digg gives you the option to specify the url you want to be dugg, as well as the target of the link, and the digg skin for the share button. The skins available are &#8216;normal&#8217;, which looks like the Digg buttons on Digg itself that displays how many diggs the story has already, &#8216;compact&#8217;, which is a smaller version of the normal skin, and lastly, the one I like best, &#8216;icon&#8217;, which is displayed above.</p>
<div style="float:left;margin:5px;"><script type="text/javascript"><!--
function fbs_click() {
u=location.href;
t=document.title;
window.open('http://www.facebook.com/sharer.php?u=http://blog.listcentral.me/2009/04/06/share-buttons-are-so-easyshare-buttons-are-so-easy/'+encodeURIComponent(u)+'&#038;t='+encodeURIComponent(t),'sharer', 'toolbar=0,status=0,width=626,height=436');
 return false;}
// --></script><a onclick="return fbs_click()" href="http://www.facebook.com/share.php?u=http://blog.listcentral.me/2009/04/06/share-buttons-are-so-easyshare-buttons-are-so-easy/" target="_blank"><img src="http://b.static.ak.fbcdn.net/images/share/facebook_share_icon.gif?8:26981" alt="" width="16" height="16" /></a></div>
<p><strong>Facebook</strong> offers brief, yet comprehensive documentation on how to create share buttons on the <a href="http://www.facebook.com/share_partners.php">Facebook Share Partners page</a>. The Facebook team has made the task of creating Facebook share buttons super easy with the script they provide, in that the developer only needs to add in the url of the page to be shared. Facebook also offers 4 options for how the share link can appear on your site, my favourite is the small icon shown above.</p>
<div class="code">
&lt;script&gt;function fbs_click() {<br />
u=location.href;<br />
t=document.title;<br />
window.open(&#8216;http://www.facebook.com/sharer.php?u=&#8217;+encodeURIComponent(u)+&#8217;&amp;t=&#8217;+encodeURIComponent(t),&#8217;sharer&#8217;,'toolbar=0,status=0,width=626,height=436&#8242;);<br />
return false;}<br />
&lt;/script&gt;&lt;a href=&#8217;http://www.facebook.com/share.php?&#8217; onclick=&#8217;return fbs_click()&#8217; target=&#8217;_blank&#8217;&gt;&lt;img src=&#8217;http://b.static.ak.fbcdn.net/images/share/facebook_share_icon.gif?8:26981&#8242; width=&#8217;16&#8242; height=&#8217;16&#8242; alt=&#8221; /&gt;&lt;/a&gt;
</div>
<div style="float:left;margin:5px;"><a href="http://www.stumbleupon.com/submit?url=http://blog.listcentral.me/2009/04/06/share-buttons-are-so-easyshare-buttons-are-so-easy/&amp;title=Share Buttons are SO Easy!!" target="_new"> <img src="http://cdn.stumble-upon.com/images/32x32_su_round.gif" border="0" alt="" width="16" height="16" /></a></div>
<p><strong>StumbleUpon</strong> has a neat page with many options to help you build your  share buttons on the <a href="http://www.stumbleupon.com/buttons.php">StumbleUpon Buttons &amp; Tools page</a>. Once you build one link through the StumbleUpon builder, it is easy to see how to edit the code in order to make other share buttons for different links automatically. All that is needed is the link&#8217;s url and title.</p>
<div class="code">
&lt;a href=&#8217;http://www.stumbleupon.com/submit?url=http://blog.listcentral.me/2009/04/06/share-buttons-are-so-easy&amp;title=Share Buttons are SO Easy!!&#8217; target=&#8217;_new&#8217;&gt; &lt;img border=0 src=&#8217;http://cdn.stumble-upon.com/images/32x32_su_round.gif&#8217; width=&#8217;16&#8242; height=&#8217;16&#8242; alt=&#8221;&gt;&lt;/a&gt;
</div>
<div style="float:left;margin:5px;"><a onclick="window.open('http://delicious.com/save?v=5&amp;noui&amp;jump=close&amp;url='+encodeURIComponent(location.href)+'&amp;title='+encodeURIComponent(document.title), 'delicious','toolbar=no,width=550,height=550'); return false;" href="http://delicious.com/save"><img src="http://static.delicious.com/img/delicious.small.gif" alt="Delicious" width="10" height="10" /> </a></div>
<p><strong>Delicious</strong> also makes creating share buttons super easy with the scripts they have posted on the <a href="http://delicious.com/help/savebuttons">Delicious Save Buttons page</a>. The code they provide requires no edits, as it works perfectly as it is. I did edit the code they provide for aesthetic reasons. I wanted to use only the Delicious icon as my share button, rather than the text &#8220;Bookmark this on Delicious&#8221; that the code Delicious provides includes, a fairly trivial change really.</p>
<div class="code">
&lt;a onclick=&#8217;window.open(&#8216;http://delicious.com/save?v=5&amp;amp;noui&amp;amp;jump=close&amp;amp;url=&#8217;+encodeURIComponent(location.href)+&#8217;&amp;amp;title=&#8217;+encodeURIComponent(document.title), &#8216;delicious&#8217;,'toolbar=no,width=550,height=550&#8242;); return false;&#8217; href=&#8217;http://delicious.com/save&#8217;&gt;&lt;img src=&#8217;http://static.delicious.com/img/delicious.small.gif&#8217; alt=&#8217;Delicious&#8217; width=&#8217;10&#8242; height=&#8217;10&#8242; /&gt; &lt;/a&gt;
</div>
<div style="float:left;margin:5px;"><a href="http://twitter.com/home?status=Check out this list: Share Buttons are SO Easy!! http://blog.listcentral.me/2009/04/06/share-buttons-are-so-easyshare-buttons-are-so-easy/" target="_new"><img src="http://twitter.com/images/favicon.png" alt="Tweet this list" width="16" height="16" /></a></div>
<p><strong>Twitter</strong> is the exception, in that they do not provide documentation on how to create share buttons on your site, but their simple design makes it reasonably easy to figure out how to do it.</p>
<div class="code">
&lt;a href=&#8217;http://twitter.com/home?status=Check this out! http://blog.listcentral.me/2009/04/06/&gt;Tweet This&#8217;&lt;/a&gt;
</div>
<p>If the user is already logged into Twitter, when they click on a link w they will be taken to their twitter home page, with the Tweet pre-populated with the text you give it after the &#8216;status=&#8217; in the link. As a developer, you can choose to use anything as the link text or image. For List Central, I chose the Twitter &#8216;t&#8217; icon, which the good folks at twitter use as their favicon.</p>
<h3  class="related_post_title">You might also like...</h3><ul class="related_post"><li><a href="http://marilynburgess.com/2009/04/centering-an-image-in-a-div/" title="Centering an image in a div">Centering an image in a div</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://marilynburgess.com/2009/04/share-buttons-are-so-easy/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Centering an image in a div</title>
		<link>http://marilynburgess.com/2009/04/centering-an-image-in-a-div/</link>
		<comments>http://marilynburgess.com/2009/04/centering-an-image-in-a-div/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 21:50:32 +0000</pubDate>
		<dc:creator>marilyn</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Add new tag]]></category>
		<category><![CDATA[Centering images]]></category>
		<category><![CDATA[Php]]></category>

		<guid isPermaLink="false">http://blog.listcentral.me/?p=46</guid>
		<description><![CDATA[While I&#8217;m trying to build List Central, I have also, slowly, been designing another blog called Urpi&#8217;s Dream. I have a long term vision for Urpi&#8217;s Dream, and while I know that I won&#8217;t be able to devote too much time to it during the reign of List Central, on occasion I get completely obsessed [...]]]></description>
			<content:encoded><![CDATA[<p>While I&#8217;m trying to build List Central, I have also, slowly, been designing another blog called <a href="http://urpisdream.com">Urpi&#8217;s Dream</a>. I have a long term vision for Urpi&#8217;s Dream, and while I know that I won&#8217;t be able to devote too much time to it during the reign of List Central, on occasion I get completely obsessed with certain aspects of this other project.</p>
<p>One of these obsessions was to build a new <a href="http://wordpress.org/extend/plugins/">WordPress plugin</a> to hold the specific functionality I want in a image gallery. Yes, I built, yet another, <strong>WordPress Image Gallery Plugin</strong>. I know there are many others out there that do the job, but none that did it to my satisfaction, so I built my own. I still have a few more touch ups to do on Urpi Gallery, but once those are completed, I&#8217;ll be releasing the plugin to the WordPress community. I&#8217;ll likely make an announcement about it here as well as on Urpi&#8217;s Dream.</p>
<p>All of that chatter has little to do with the point of this post. The point of this post is to discuss how to dynamically center and image in a div! So let&#8217;s get to the meat of it!</p>
<p>A part of the Urpi Gallery, mentioned above, is a rotating image widget that can either be used on the sidebar, or in posts. Here&#8217;s an example of it, with some purdy pictures of flowers I found on Flickr under the Creative Commons license :</p>
<h2></h2><p></p><div style='position:relative'><script type='text/javascript' src='http://marilynburgess.com/wp-content/plugins/urpi-gallery/js/urpibox.js'></script><link rel='stylesheet' href='http://marilynburgess.com/wp-content/plugins/urpi-gallery/css/urpibox.css' type='text/css' media='screen' /><script type='text/javascript' src='http://marilynburgess.com/wp-content/plugins/urpi-gallery/js/Transitions.js'></script> <script type='text/javascript'> 
                   jQuery(document).ready(function() { 
                    jQuery('#_slideshow').cycle({             
                        fx:'scrollLeft,scrollDown,scrollRight,scrollUp,blindX,blindY,cover,curtainX,curtainY,fade,fadeZoom,slideX,slideY,turnUp,turnDown,turnLeft,turnRight,uncover,wipe,zoom', 
                        randomizeEffects: true, 
                        timeout:  5000,
                        random:  1                        
                    }); 
                });</script>  <div style=' height:242px; width:242px;padding: 0;margin:0px;background-color:#E0E0E0' id='outter'><div id='_slideshow' style='position: relative; height:242px; width:242px;padding: 0;margin:0px;' class='UrpiDynamicWidgetWrapper'></div></div></div><div style='clear:left'></div><br /><br />
<p>As you can see above, the dynamically chosen image is very nicely centered in that gray div. I thought that centering an image in a div, as above, would be a piece of cake, but it turned out not to be so clear cut.</p>
<p>Centering an image in a table cell, both horizontally and vertically is trivial:</p>
<table border="0">
<tbody>
<tr>
<td class="centeredImageTD"><img src="/images/Benny.jpg" alt="Benny" width="150" /></td>
<td style="vertical-align:top;"><code>&amp;lt;style&amp;gt;<br />
.centeredImageTD {<br />
width: 180px;<br />
height: 180px;<br />
vertical-align:middle;<br />
text-align:center<br />
}<br />
&amp;lt;/style&amp;gt;</code></p>
<p>&lt;td class=&#8221;centeredImageTD&#8221;&gt;<br />
&lt;img src=&#8221;Benny.jpg&#8221; width=&#8221;120&#8243; alt=&#8221;Benny&#8221; /&gt;<br />
&lt;/td&gt;</td>
</tr>
</tbody>
</table>
<p>Isn&#8217;t that easy? All done with some css on the table cell (td) that explicitly states: center the content of this table cell, both horizontally and vertically. The dimensions of the image don&#8217;t matter with this method of centering.</p>
<p>As the web has evolved, the appropriateness of tables in web design has decreased, and the task now is to put our designs together using divs. The use of divs improves many web design tasks, but it makes this one task, of centering images more difficult. While the tag can be used in a pinch to center an image horizontally, there is no equivalent tag or style rule to center an image vertically. The only option is to <strong>use the margins of the image, or the padding on the div</strong>. Both <strong>require that you know the width and height of the image, and div</strong>.</p>
<p>As I was determined to have my images centered in a div, I got down to writing  my  php functions to make it happen, every time. The function below requires that you pass the actual dimension of the image, which can be captured with tools like <em>identify </em>from <a href="http://www.imagemagick.org/script/identify.php">ImageMagick</a>, or with the built in php functions <a href="http://ca3.php.net/imagesx">imagesx</a> and <a href="http://ca3.php.net/imagesy">imagesy</a>.<em> </em>Also required by the function is the  desired width of the border given to the image ($border_width), and the width of the div you want to center your image in as $divsize.  This function assumes your div is square, but it is possible to adapt this function to accommodate rectangular divs.</p>
<p><code>/*<br />
getCenteredMargins  - determines the margins for an the image to be centered in a div</code></p>
<p>1. $imagefile &#8211; Path to the image<br />
2. $divsize &#8211; The width and height of the square div containing the image in pixels<br />
3. $border_width &#8211; The width of the desired boreder around the image in pixels<br />
4. $max_size &#8211; The maximum width and height of the image as it is to appear on the page<br />
*/<br />
function getCenteredMargins($image_width, $image_height, $divsize, $border_width, $max_size){</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;// Initializations<br />
&nbsp;&nbsp;&nbsp;&nbsp;$width = 0; $height = 0;<br />
&nbsp;&nbsp;&nbsp;&nbsp;$margin_top_bottom = &#8220;&#8221;; $margin_left_right = &#8220;&#8221;;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;if($image_width &gt; $image_height){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Most likely a pic landscape orientation, width of &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the image will<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// equal the max_size<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$width = $max_size;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Determine scaled down height of the image with the the ratio<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// of the original image<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$height = (int)($max_size * $image_height / $image_width);</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// right and left margins will be small, and equal to the<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// specified border width<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$margin_left_right = $border_width . &#8220;px&#8221;;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// top and bottom margins will be larger<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$margin_top_bottom = (int)(($divsize &#8211; $height) / 2) . &#8220;px&#8221;;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}else{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Most likely a pic portrait orientation, height of the image will<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// equal the max_size<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$height = $max_size;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Determine scaled down width of the image with the the ratio<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// of the original image<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$width = (int)($max_size * $image_width / $image_height);</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// top and bottom margins will be small, and equal to the<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// specified border width<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$margin_top_bottom = $border_width . &#8220;px&#8221;;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// right and left margins will be larger<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$margin_left_right = (int)(($divsize &#8211; $width) / 2) . &#8220;px&#8221;;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;return array($margin_top_bottom, $margin_left_right,$width, $height);<br />
}<br />
list($margin_top_bottom , $margin_left_right, $width, $height) = getCenteredMargins($image_width, $image_height, $divsize, $border_width, $max_size);<br />
$image_style = &#8220;margin: $margin_top_bottom $margin_left_right;&#8221;;<br />
$html = &#8220;&lt;div&gt;&lt;img  style=&#8221;$image_style&#8221; src=&#8221;$src&#8221; width=&#8221;$width&#8221; height=&#8221;$height&#8221; /&gt;&lt;/div&gt;&#8221;;<br />
</code></p>
<h3  class="related_post_title">You might also like...</h3><ul class="related_post"><li><a href="http://marilynburgess.com/2009/04/share-buttons-are-so-easy/" title="Share Buttons are SO Easy!!">Share Buttons are SO Easy!!</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://marilynburgess.com/2009/04/centering-an-image-in-a-div/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

