ZenphotoCMS Forum
Version 1.2.2: bad SQL query in getImageRotation() - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: General support (https://forum.zenphoto.org/forum-4.html)
+--- Thread: Version 1.2.2: bad SQL query in getImageRotation() (/thread-4182.html)



Version 1.2.2: bad SQL query in getImageRotation() - lukehough - 2008-12-03

The current query method is this:
$result = query_single_row(' SELECT EXIFOrientation FROM '.prefix('images').' AS i, '.prefix('albums').' AS a WHERE i.albumid = a.id');
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.

function getImageRotation($imgfile) { $result = query_single_row(' SELECT EXIFOrientation FROM '.prefix('images').' AS i JOIN '.prefix('albums').' as a ON i.albumid = a.id WHERE "'.$imgfile.'" LIKE CONCAT("%",a.folder,"/",i.filename)');
This should return a unique result.

Disclaimer: I'm no pro so some of this may be wrong.

-Luke




Version 1.2.2: bad SQL query in getImageRotation() - sbillard - 2008-12-04

Thanks, fix is in the nightly build tonight.