Store thumbnail paths as relative to datadir.
I went back on this originally, now I'm going... forth on it. Although the photo files need to be absolute paths, thumbnails should be relative so you can relocate the photodb and have it still work properly.
This commit is contained in:
parent
b5d1c12c11
commit
f8efc9d569
1 changed files with 5 additions and 3 deletions
|
@ -983,11 +983,13 @@ class Photo(ObjectBase):
|
|||
return_filepath = hopeful_filepath
|
||||
|
||||
if return_filepath != self.thumbnail:
|
||||
if return_filepath is not None:
|
||||
return_filepath = return_filepath.absolute_path
|
||||
if return_filepath is None:
|
||||
store_as = None
|
||||
else:
|
||||
store_as = return_filepath.relative_to(self.photodb.thumbnail_directory)
|
||||
data = {
|
||||
'id': self.id,
|
||||
'thumbnail': return_filepath,
|
||||
'thumbnail': store_as,
|
||||
}
|
||||
self.photodb.sql_update(table='photos', pairs=data, where_key='id')
|
||||
self.thumbnail = return_filepath
|
||||
|
|
Loading…
Reference in a new issue