<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Quick shutter-speed fix for WordPress EXIF</title>
	<atom:link href="http://www.enliteart.com/blog/2008/08/30/quick-shutter-speed-fix-for-wordpress-exif/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.enliteart.com/blog/2008/08/30/quick-shutter-speed-fix-for-wordpress-exif/</link>
	<description>A Young Biologist’s Thoughts on Biology, Photography and Research</description>
	<lastBuildDate>Thu, 06 Jan 2011 14:13:45 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Andrew</title>
		<link>http://www.enliteart.com/blog/2008/08/30/quick-shutter-speed-fix-for-wordpress-exif/comment-page-1/#comment-3601</link>
		<dc:creator>Andrew</dc:creator>
		<pubDate>Tue, 15 Jun 2010 04:25:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.enliteart.com/blog/?p=165#comment-3601</guid>
		<description>Good idea Otto.  I always thought there should be a better way to deal with the decimal than the manual entry.  I think I will incorporate something similar.</description>
		<content:encoded><![CDATA[<p>Good idea Otto.  I always thought there should be a better way to deal with the decimal than the manual entry.  I think I will incorporate something similar.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Otto</title>
		<link>http://www.enliteart.com/blog/2008/08/30/quick-shutter-speed-fix-for-wordpress-exif/comment-page-1/#comment-3599</link>
		<dc:creator>Otto</dc:creator>
		<pubDate>Mon, 14 Jun 2010 19:55:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.enliteart.com/blog/?p=165#comment-3599</guid>
		<description>A somewhat simpler approach:
&lt;code&gt;
if ((1 / $imagemeta[&#039;image_meta&#039;][&#039;shutter_speed&#039;]) &gt; 1) {
	echo &quot;1/&quot;;
		if (number_format((1 / $imagemeta[&#039;image_meta&#039;][&#039;shutter_speed&#039;]), 1) ==  number_format((1 / $imagemeta[&#039;image_meta&#039;][&#039;shutter_speed&#039;]), 0)) {
			echo number_format((1 / $imagemeta[&#039;image_meta&#039;][&#039;shutter_speed&#039;]), 0, &#039;.&#039;, &#039;&#039;) . &#039; sec&#039;;
		} else {
			echo number_format((1 / $imagemeta[&#039;image_meta&#039;][&#039;shutter_speed&#039;]), 1, &#039;.&#039;, &#039;&#039;) . &#039; sec&#039;;
		}
	} else {
		echo $imagemeta[&#039;image_meta&#039;][&#039;shutter_speed&#039;].&#039; sec&#039;;
	}
&lt;/code&gt;

Basically I compare the 1 decimal version to the 0 decimal version. If they&#039;re equal, then the final digit is zero and you can display it with no decimal. If they&#039;re different, the final digit is not zero, so display it.

This solves your 1.3, 1.5, 1.6, etc problem without checking for them manually.</description>
		<content:encoded><![CDATA[<p>A somewhat simpler approach:<br />
<code><br />
if ((1 / $imagemeta['image_meta']['shutter_speed']) &gt; 1) {<br />
	echo "1/";<br />
		if (number_format((1 / $imagemeta['image_meta']['shutter_speed']), 1) ==  number_format((1 / $imagemeta['image_meta']['shutter_speed']), 0)) {<br />
			echo number_format((1 / $imagemeta['image_meta']['shutter_speed']), 0, '.', '') . ' sec';<br />
		} else {<br />
			echo number_format((1 / $imagemeta['image_meta']['shutter_speed']), 1, '.', '') . ' sec';<br />
		}<br />
	} else {<br />
		echo $imagemeta['image_meta']['shutter_speed'].' sec';<br />
	}<br />
</code></p>
<p>Basically I compare the 1 decimal version to the 0 decimal version. If they&#8217;re equal, then the final digit is zero and you can display it with no decimal. If they&#8217;re different, the final digit is not zero, so display it.</p>
<p>This solves your 1.3, 1.5, 1.6, etc problem without checking for them manually.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: philosp</title>
		<link>http://www.enliteart.com/blog/2008/08/30/quick-shutter-speed-fix-for-wordpress-exif/comment-page-1/#comment-3490</link>
		<dc:creator>philosp</dc:creator>
		<pubDate>Fri, 28 May 2010 03:58:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.enliteart.com/blog/?p=165#comment-3490</guid>
		<description>&lt;p&gt;This works for me:&lt;br /&gt;
&lt;pre&gt;&lt;br /&gt;
function decimal2fraction ($number)&lt;br /&gt;
{&lt;br /&gt;
    list ($whole, $numerator) = explode (&#039;.&#039;, $number);&lt;br /&gt;
    $denominator = 1 . str_repeat (0, strlen ($numerator));&lt;br /&gt;
    $GCD = GCD ($numerator, $denominator);&lt;br /&gt;
    $numerator /= $GCD;&lt;br /&gt;
&lt;br /&gt;
    $denominator /= $GCD;&lt;br /&gt;
    if($whole == 0)&lt;br /&gt;
        return sprintf (&#039;1/%d&#039;, round($denominator/$numerator));&lt;br /&gt;
    return sprintf (&#039;%d 1/%d&#039;,&lt;br /&gt;
        $whole, round($denominator/$numerator));&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function GCD ($a, $b)&lt;br /&gt;
{&lt;br /&gt;
    while ( $b != 0)&lt;br /&gt;
      {&lt;br /&gt;
        $remainder = $a % $b;&lt;br /&gt;
        $a = $b;&lt;br /&gt;
        $b = $remainder;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
    return abs ($a);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;/pre&gt;&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>This works for me:</p>
<pre>
function decimal2fraction ($number)
{
    list ($whole, $numerator) = explode ('.', $number);
    $denominator = 1 . str_repeat (0, strlen ($numerator));
    $GCD = GCD ($numerator, $denominator);
    $numerator /= $GCD;

    $denominator /= $GCD;
    if($whole == 0)
        return sprintf ('1/%d', round($denominator/$numerator));
    return sprintf ('%d 1/%d',
        $whole, round($denominator/$numerator));
}

function GCD ($a, $b)
{
    while ( $b != 0)
      {
        $remainder = $a % $b;
        $a = $b;
        $b = $remainder;

      }
    return abs ($a);
}
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: kristarella</title>
		<link>http://www.enliteart.com/blog/2008/08/30/quick-shutter-speed-fix-for-wordpress-exif/comment-page-1/#comment-15</link>
		<dc:creator>kristarella</dc:creator>
		<pubDate>Tue, 25 Nov 2008 21:25:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.enliteart.com/blog/?p=165#comment-15</guid>
		<description>Thank you! I was about to do something just like this myself, but thought I should check the comments on Sarah&#039;s post in case someone already had. You saved me much time and musings on how I wanted to do it!</description>
		<content:encoded><![CDATA[<p>Thank you! I was about to do something just like this myself, but thought I should check the comments on Sarah&#8217;s post in case someone already had. You saved me much time and musings on how I wanted to do it!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shane</title>
		<link>http://www.enliteart.com/blog/2008/08/30/quick-shutter-speed-fix-for-wordpress-exif/comment-page-1/#comment-6</link>
		<dc:creator>Shane</dc:creator>
		<pubDate>Thu, 11 Sep 2008 16:15:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.enliteart.com/blog/?p=165#comment-6</guid>
		<description>Thank you for sharing this!  I just got a Nikon SLR camera yesterday and have planned on trying to show this information as soon as I got a new camera.  I&#039;m going to try and see if I can get the full size dimensions to show up like Matt has on his site, but your setup is exactly what I was looking for.  Thank you again!</description>
		<content:encoded><![CDATA[<p>Thank you for sharing this!  I just got a Nikon SLR camera yesterday and have planned on trying to show this information as soon as I got a new camera.  I&#8217;m going to try and see if I can get the full size dimensions to show up like Matt has on his site, but your setup is exactly what I was looking for.  Thank you again!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

