@ -18,7 +18,7 @@ export function do_image_query(query, database, collection_path, collection_thum
ids . push ( row [ "id" ] ) ; //uniquify
var imagepath = process . env . PUBLIC _URL + collection _path + "/" + row [ "relativePath" ] + "/" + row [ "name" ] ;
var thumbpath = process . env . PUBLIC _URL + collection _thumbs _path + "/" + row [ "uniqueHash" ] + ".jpg" ;
photos . push ( create _photo ( row [ "id" ] , row [ "name" ] , imagepath , thumbpath ) ) ;
photos . push ( create _photo ( row [ "id" ] , row [ "name" ] , imagepath , thumbpath , [ row [ "width" ] , row [ "height" ] ] ) ) ;
}
} ) ;
}
@ -223,7 +223,12 @@ export class UserQuery {
// This query will return database entries with the fields "id", "uniqueHash", "relativePath" (of the album) and "name" for each matching image.
export function image _query _with _where ( maybe _where ) {
return "SELECT Images.id, Images.name, Images.uniqueHash, Albums.relativePath FROM Images INNER JOIN Albums ON Images.album=Albums.id LEFT JOIN ImageTags ON Images.id=ImageTags.imageid LEFT JOIN Tags ON ImageTags.tagid=Tags.id " + ( maybe _where ? maybe _where : "" ) ;
return "SELECT Images.id, Images.name, Images.uniqueHash, Albums.relativePath, "
+ "ImageInformation.width, ImageInformation.height "
+ "FROM Images INNER JOIN Albums ON Images.album=Albums.id "
+ "LEFT JOIN ImageTags ON Images.id=ImageTags.imageid "
+ "LEFT JOIN ImageInformation ON Images.id=ImageInformation.imageid "
+ "LEFT JOIN Tags ON ImageTags.tagid=Tags.id " + ( maybe _where ? maybe _where : "" ) ;
// TODO: the following for some reason breaks the query:
//+ " GROUP BY Images.id;";
}