<?xml version="1.0" encoding="UTF-8"?><!-- generator="bbPress" -->

<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
>

<channel>
<title>zenphoto forums Topic: Version 1.2.2: bad SQL query in getImageRotation()</title>
<link>http://www.zenphoto.org/support/</link>
<description>zenphoto forums Topic: Version 1.2.2: bad SQL query in getImageRotation()</description>
<language>en</language>
<pubDate>Thu, 23 May 2013 12:30:27 +0000</pubDate>

<item>
<title>sbillard on "Version 1.2.2: bad SQL query in getImageRotation()"</title>
<link>http://www.zenphoto.org/support/topic.php?id=4440#post-26254</link>
<pubDate>Wed, 03 Dec 2008 17:18:51 +0000</pubDate>
<dc:creator>sbillard</dc:creator>
<guid isPermaLink="false">26254@http://www.zenphoto.org/support/</guid>
<description>&#60;p&#62;Thanks, fix is in the nightly build tonight.
&#60;/p&#62;</description>
</item>
<item>
<title>lukehough on "Version 1.2.2: bad SQL query in getImageRotation()"</title>
<link>http://www.zenphoto.org/support/topic.php?id=4440#post-26240</link>
<pubDate>Wed, 03 Dec 2008 10:54:11 +0000</pubDate>
<dc:creator>lukehough</dc:creator>
<guid isPermaLink="false">26240@http://www.zenphoto.org/support/</guid>
<description>&#60;p&#62;The current query method is this:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;$result = query_single_row(&#38;#39;
    SELECT EXIFOrientation
    FROM &#38;#39;.prefix(&#38;#39;images&#38;#39;).&#38;#39; AS i, &#38;#39;.prefix(&#38;#39;albums&#38;#39;).&#38;#39; AS a
    WHERE i.albumid = a.id&#38;#39;);&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;which returns all EXIFOrientation entries, then selects the first. Since the unique image ID does not appear to be available to this function, I have passed $imgfile containing the full file path. Then queried based on $imgfile containing the album directory and image filename.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;function getImageRotation($imgfile) {
  $result = query_single_row(&#38;#39;
     SELECT EXIFOrientation
     FROM &#38;#39;.prefix(&#38;#39;images&#38;#39;).&#38;#39; AS i
     JOIN &#38;#39;.prefix(&#38;#39;albums&#38;#39;).&#38;#39; as a
     ON i.albumid = a.id
     WHERE &#38;quot;&#38;#39;.$imgfile.&#38;#39;&#38;quot; LIKE CONCAT(&#38;quot;%&#38;quot;,a.folder,&#38;quot;/&#38;quot;,i.filename)&#38;#39;);&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;This should return a unique result.&#60;/p&#62;
&#60;p&#62;Disclaimer: I'm no pro so some of this may be wrong.&#60;/p&#62;
&#60;p&#62;-Luke
&#60;/p&#62;</description>
</item>

</channel>
</rss>
