zenphoto forums » Bug Discussion

Version 1.2.2: bad SQL query in getImageRotation()

(2 posts)
  • Started 4 years ago by lukehough
  • Latest reply from sbillard
  1. lukehough

    Apprentice
    Joined: Dec '08
    Posts: 1

    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

    Posted 4 years ago #
  2. Zenphoto development team
    sbillard

    Chief Developer
    Joined: May '07
    Posts: 9,818

    Thanks, fix is in the nightly build tonight.

    Don't forget to read the Forum rules and usage resources
    Posted 4 years ago #

RSS feed for this topic

Reply

You must log in to post.