From bad452d42ddc2f841d6d91f174cc772d7cf1c391 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Thu, 31 May 2001 02:40:08 +0000 Subject: [PATCH] Check for image load failure svn: r69 --- src/RelImage.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/RelImage.py b/src/RelImage.py index 3cf03cb64..0a429e3e9 100644 --- a/src/RelImage.py +++ b/src/RelImage.py @@ -26,6 +26,7 @@ import os import const import intl +from gnome.ui import * _ = intl.gettext @@ -76,11 +77,18 @@ def import_photo(filename,path,prefix): #------------------------------------------------------------------------- def scale_image(path,size): import GdkImlib + + try: + image1 = GdkImlib.Image(path) + except: + GnomeWarningDialog(_("Could load load image file %s") % path) + return - image1 = GdkImlib.Image(path) width = image1.rgb_width height = image1.rgb_height scale = size / float(max(width,height)) image2 = image1.clone_scaled_image(int(scale*width), int(scale*height)) return image2 + +