Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/utils.py
diff options
context:
space:
mode:
authorerikb <erikb@574bc980-5f2d-0410-acbc-c8f9f0eb14e0>2007-10-31 18:46:39 (GMT)
committer erikb <erikb@574bc980-5f2d-0410-acbc-c8f9f0eb14e0>2007-10-31 18:46:39 (GMT)
commit18f5cc956b31e94dc29c526c5ab2d8946a481102 (patch)
tree2ea00c373b6d3ad04f5db08d1cf73489fd8adcf9 /utils.py
parentcb1d37dbc33074a7539df0004965c82792ce4da4 (diff)
yet more refactoring
git-svn-id: http://mediamods.com/public-svn/camera-activity/Record.activity@789 574bc980-5f2d-0410-acbc-c8f9f0eb14e0
Diffstat (limited to 'utils.py')
-rw-r--r--utils.py25
1 files changed, 24 insertions, 1 deletions
diff --git a/utils.py b/utils.py
index 591c436..0f36628 100644
--- a/utils.py
+++ b/utils.py
@@ -42,4 +42,27 @@ def getUniqueFilepath( path, i ):
newPath = os.path.join( os.path.dirname(pathOb), str( str(i) + os.path.basename(pathOb) ) )
return getUniqueFilepath( str(newPath), i )
else:
- return os.path.abspath( path ) \ No newline at end of file
+ return os.path.abspath( path )
+
+
+def md5File( filepath ):
+ md = md5()
+ f = file( filepath, 'rb' )
+ md.update( f.read() )
+ digest = md.hexdigest()
+ hash = util.printable_hash(digest)
+ return hash
+
+
+def generateThumbnail( pixbuf, scale, thumbw, thumbh ):
+ #need to generate thumbnail version here
+ thumbImg = cairo.ImageSurface(cairo.FORMAT_ARGB32, thumbw, thumbh)
+ tctx = cairo.Context(thumbImg)
+ img = _camera.cairo_surface_from_gdk_pixbuf(pixbuf)
+ tctx.scale(scale, scale)
+ tctx.set_source_surface(img, 0, 0)
+ tctx.paint()
+
+ gc.collect()
+
+ return thumbImg \ No newline at end of file