示例#1
0
        def imgResVal(resource, assetId):
            imageInfo = self._imageInfoObj.getImageInfo(resource, assetId)

            # Now process the image information
            # use an ImgInfoFmt object, to abstract from flat format
            imgfmt = ImgInfoFmt()
            imgfmt.lib = self.namespace
            if not 'type' in imageInfo:
                raise RuntimeError, "Unable to get image info from file: %s" % resource
            imgfmt.type = imageInfo['type']

            # Add this image
            # imageInfo = {width, height, filetype}
            if not 'width' in imageInfo or not 'height' in imageInfo:
                raise RuntimeError, "Unable to get image info from file: %s" % resource
            imgfmt.width = imageInfo['width']
            imgfmt.height = imageInfo['height']
            imgfmt.type = imageInfo['type']

            return imgfmt