def get_binary(self, **kwargs): """ Returns binary in encoding base64. """ from tendenci.apps.files.utils import build_image size = kwargs.get('size') or self.image_dimensions() binary = build_image(self.file, size, 'FILE_IMAGE_PRE_KEY') return b64encode(binary)