Check for image load failure

svn: r69
This commit is contained in:
Don Allingham 2001-05-31 02:40:08 +00:00
parent b16ceb6be1
commit ad0d5d0415

View File

@ -26,6 +26,7 @@
import os
import const
import intl
from gnome.ui import *
_ = intl.gettext
@ -77,10 +78,17 @@ 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
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