Commits

Kevin Chan committed 2ee1cb4

Fixed bug in filebrowser version_generator that creates thumbs in wrong
directory (use relative path instead of full path in createVersions
method).

Comments (0)

Files changed (1)

management/commands/version_generator.py

 
 class Command(NoArgsCommand):
     help = "(Re)Generate versions of Images"
-
+    
     def handle_noargs(self, **options):
         import os, re
         from filebrowser.settings import EXTENSION_LIST, EXCLUDE, MEDIA_ROOT, DIRECTORY, VERSIONS, EXTENSIONS
                     self.createVersions(os.path.join(dirpath, filename))
     
     def createVersions(self, path):
+        from filebrowser.settings import MEDIA_ROOT
         print "generating versions for: ", path
         from filebrowser.settings import VERSIONS
         from filebrowser.functions import version_generator
+        # BUGFIX: supply path relative to MEDIA_ROOT (not full path)
+        rel_path = path.replace(MEDIA_ROOT, '')
         for version in VERSIONS:
             #print "                          ", version
-            version_generator(path, version, True)
+            # BUGFIX: use rel_path instead of path
+            thumb = version_generator(rel_path, version, True)
+            #thumb = version_generator(path, version, True)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.