def imgResVal(resource): imgId = resource # Cache or generate if (imgId in imgLookupTable and imgLookupTable[imgId ]["time"] > os.stat(imgId ).st_mtime): imageInfo = imgLookupTable[imgId ]["content"] else: imageInfo = self._imageInfo.getImageInfo(imgId , assetId) imgLookupTable[imgId ] = {"time": time.time(), "content": imageInfo} # Now process the image information # use an ImgInfoFmt object, to abstract from flat format imgfmt = ImgInfoFmt() imgfmt.lib = lib['namespace'] if not 'type' in imageInfo: raise RuntimeError, "Unable to get image info from file: %s" % imgId 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" % imgId imgfmt.width = imageInfo['width'] imgfmt.height = imageInfo['height'] imgfmt.type = imageInfo['type'] return imgfmt
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
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