Пример #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)
Пример #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)
Пример #3
0
    def __call__(self):
        image = self.field.get(self.context)
        if not image:
            return None

        url = "/".join((self.context.absolute_url(), "@@images", self.field.__name__))

        width, height = image.getImageSize()
        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)
Пример #4
0
    def __call__(self):
        image = self.field.get(self.context)
        if not image:
            return None

        url = '/'.join(
            (self.context.absolute_url(), '@@images', self.field.__name__))

        width, height = image.width, image.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)
Пример #5
0
    def __call__(self):
        image = self.field.get(self.context)
        if not image:
            return None

        url = '/'.join((self.context.absolute_url(),
                        '@@images',
                        self.field.__name__))

        width, height = image.width, image.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)