When I first installed this module, my site started throwing a lot of database errors. In short, the file_aliases_preprocess_image_style() function, in line 49 of file_aliases.module tries to query the database for an empty "fid". At least on my Postgres server, this caused a nasty DB error.
Looking at the documentation of drupal_lookup_path, if an alias for that file does not exist, then it returns false. Therefore, I added a check for that false return, in which case it would not try to find an alias. This is my resulted function:
function file_aliases_preprocess_image_style(&$variables) {
global $base_url;
$source = drupal_lookup_path('source', str_replace($base_url . base_path(), '', $variables['path']));
if ($source !== FALSE) {
$fid = drupal_substr($source, 22);
if ($uri = db_query("SELECT uri FROM {file_managed} WHERE fid = :fid", array(':fid' => $fid))->fetchField()) {
$variables['path'] = $uri;
}
}
}
Comments
Comment #1
greg.1.anderson commentedI second that. This module works great under mysql, but when I tried to use it with a postgresql db, I got db errors as described above, preventing all file uploads. The described fix also worked great for me.
I have attached it as a patch against the -dev branch.
Comment #2
neRok commentedI have made a patch to fix a bunch of issues with File Aliases module, including this issue, in the following issue.
#1896326: Combined patch for all known issues in D7 branch
Comment #3
decipheredThanks, fixed and committed.