Ejemplo n.º 1
0
    def __call__(self):
        image = self.field.get(self.context)
        if not image:
            return None

        width, height = image.getImageSize()

        url = get_original_image_url(
            self.context,
            self.field.__name__,
            width,
            height,
        )

        scales = get_scales(self.context, self.field, width, height)
        result = {
            'filename': image.filename,
            'content-type': image.contentType,
            'size': image.getSize(),
            'download': url,
            'width': width,
            'height': height,
            'scales': scales
        }
        return json_compatible(result)
Ejemplo n.º 2
0
    def __call__(self):
        image = self.field.get(self.context)
        if not image:
            return None

        width, height = image.width, image.height
        url = get_original_image_url(self.context, self.field.__name__, width, height)

        scales = get_scales(self.context, self.field, width, height)
        result = {
            "filename": self.field.getFilename(self.context),
            "content-type": self.field.get(self.context).getContentType(),
            "size": self.field.get(self.context).get_size(),
            "download": url,
            "width": width,
            "height": height,
            "scales": scales,
        }
        return json_compatible(result)