DataBase handling
ALWAYS do a proper
prepare()
when receiving data from the DB.
I can’t say it often enough…
$galleries = $wpdb->get_results(
$wpdb->prepare( "
SELECT t.*, tt.*
FROM %s AS t
INNER JOIN $wpdb->nggpictures AS tt ON t.gid = tt.galleryid
WHERE tt.exclude != 1
GROUP BY tt.galleryid ORDER by tt.galleryid
" ),
$wpdb->nggallery
);
NextGen…
…simply isn’t involved. You’re doing a normal request via the WP DB class object. So the problem is completely elsewhere. I’d suggest to turn off all plugins aside from NextGen, activate the default TwentyTen/Eleven Theme, drop your code in there and then see if it happens again.
Update: If the plugin is lowercasing the files…
In this case, the nextgen plugin is (90% chance that it’s that way) lowercase
ing the files on upload. Not much what you can do against it without killing the plugin itself (updates, core changes, etc.).
My suggestion:
- Fix it when calling the files if you want a prettier output.
ucwords
,mb_strtoupper()
, etc. - Don’t fix it if it’s only about the filename.